Jquery-mobile: How not to add a page to the history stack?

I have an application that includes a number of forms, each on its own page.

I do not want some of these pages to be added to the history stack. Thus, when the user clicks back, he skips them.

JQuery-mobile does this through dialogs. You can configure this for ALL pages (or any other data role), but not just with some pages.

Does anyone know how to do this? Alternatively, is it possible to create a new data role that extends the page. If it was possible, I could turn off the history for all of these pages.

+4
source share
3 answers

in this case, you can call $.mobile.changePage() yourself:

 $.mobile.changePage( "url", { changeHash: false //do not track it in history }); 

http://jquerymobile.com/demos/1.2.0/docs/pages/page-navmodel.html http://jquerymobile.com/demos/1.2.0/docs/api/methods.html

+5
source

I ran into the same problem and I was berserk! Finally, I was able to do this with the following code that does just that!

The code below automatically prevents the saving of changed locations for all pages in the current document.

Please note that it has been tested with jqm 1.4.2

 <script> $(document).on("pagebeforetransition",function(event, ui){ ui.options.changeHash = false; }) ; </script> 

Hope this helps

+1
source

Check out this question, pretty much similar to what you are trying to do.

How to change mobile event history in jQuery Back behavior buttons

Thanks, Alex.

0
source

All Articles