Why does dynamic pages reload when the back button is pressed?

I am working with jQuery mobile 1.0.1.

I have a page that boils down to a list page. The list page is dynamically generated because the links to it have an href on a separate page.

What I find confused is that when I click the back button on the detail page, there is an ajax call to grab the listing page. I don't understand why this should happen, since the listing page is in the DOM.

Not only is this inefficient, but let's say I have filtered a list on the listing page, this information will be lost when the list page is reloaded.

I found a workaround where there is a page with a blank listing on the first page being loaded, then dynamically changing it by making the ajax call itself. When I do this, it doesn't make an ajax call when navigating from detail page to listing page.

Any help would be appreciated.


source to share

1 answer

jQuery Mobile removes pseudo-pages from the DOM after they are moved (this is for external pages only). You can stop this behavior on a single pseudo page by adding an attribute data-dom-cache="true"

to the element data-role="page"

for the pseudo page:

<div data-dom-cache="true" data-role="page">


There are other ways to enable (it is good to disable, in my opinion) this functionality; you can read about them here: http://jquerymobile.com/demos/1.0.1/docs/pages/page-cache.html



All Articles