This code was used to work in JQM to delete previous pages from the DOM, so that when you click "back" it updates the contents of the previous page.
$('div').live('pagehide', function(event, ui) { $(event.target).remove(); });
However, this happened in the last jQuery update, because "$ (). Live" was deprecated, and I could not get it to work using "on" or "bind" with the updated parameters.
Has anyone found a working solution for this?
UPDATE:
I cannot use "document.location" because I cannot display specific pages in the "Back" stack.
For example, if I go to the "submit page", and when it is sent, I simply throw History.Back (); and it brings you back to the updated "details page". I don’t want them to click “Back” in the navigation bar and return to the “send page” page again, since the item cannot be sent twice. There are reasons why I don’t use a dialog or popup for this, but that would be too long to explain.
I tried:
$(document).on("pagehide", "#PageId", function () { $(event.target).remove(); });
And it does not work completely, it changes the URL path when I issue History.Back (); but the page remains on the submit page. When I used the code $ (). Live, it worked fine. Maybe "on" is not a good replacement?
source share