jQuery UI Dialog Iframe - Remove From Browser History Upon Close -
i use jquery ui dialog iframe
in order provide in-page "pop-up" editing. every time dialog opened, adds 2 requests browser history: 1 url loaded when opened, , 1 setting src
blank when dialog closed. if end-user clicks button, don't see happening, because it's going in iframe
no longer being displayed.
so, understand why happening, i'm having trouble figuring out how prevent it. there way "rewind" history on iframe
when closed?
$(document).ready(function() { var $iframe = $('<iframe id="uidialogiframe" data-reload="0" frameborder="0" marginwidth="0" marginheight="0" width="800" height="450" />'); var $dialog = $('<div id="uidialogiframewrapper" />').append($iframe).appendto('body').dialog({ autoopen: false, modal: true, resizable: false, width: 'auto', height: 'auto', close: function () { $iframe.attr('src', ''); if ('1' === $iframe.attr('data-reload')) { location.reload(); } } }); $('a.uidialogiframe').on('click', function (e) { e.preventdefault(); var $this = $(this); $iframe.attr('src', $this.attr('href')); $dialog.dialog('option', 'title', $this.data('title')) .dialog('open'); }); });
with html5 seems there nice new things can history object
some additional information mozilla
this blurb here can add additional code control how these loads effect history.
- when state changes, e.g. user opens email, history.pushstate() passed state information , executed. enables button — importantly — not move user page.
- you can run history.pushstate() many times necessary, or modify current state using history.replacestate().
- when user clicks (or forward), window.onpopstate event fired. handler function can retrieve associated state , display appropriate screen.
may not 100% how should looking in right place.
Comments
Post a Comment