1

What I got working so far:

Store a few pages in the DOM so that when the user uses the browser's back or forward button it will quickly show the page without reloading it.

What I need help with:

When a user clicks a link to a page that is already in the DOM (for back/forward functionality), I want to remove the requested page from the DOM before jqm processes the request so that the requested page is retrieved from the server rather than the DOM.

If this is possible I'm guessing I need to somehow use the pagebeforechange event.

Basically, I want jqm to use the DOM only for back/forward navigation. Otherwise I want the page to be retrieved from the server.

user3067877
  • 103
  • 1
  • 6
  • Removing a page from DOM, doesn't remove it from history. You'll need to listen to `navigate` event as well as `pagebeforechange` http://stackoverflow.com/questions/18211984/how-to-control-back-button-event-in-jquery-mobile – Omar Apr 15 '14 at 20:59
  • Thanks for reply. I'm not looking to remove it from history. If the browser's back/forward button is not used but the requested page is in the DOM I want to remove the page from the DOM before jqm processes the request so that it gets the page from the server instead of using the cached page. I'll look into navigation event. – user3067877 Apr 15 '14 at 22:06
  • If you're using single page model, any page will be removed from dom once you navigate away, except for first loaded page. – Omar Apr 15 '14 at 22:26
  • Yea, but I set domCache=true for all pages. I then keep, at most, 4 pages in the DOM for fast back/forward navigation. It may be overkill but I want the site to be fast and limit data usage for mobile users. – user3067877 Apr 15 '14 at 22:39
  • In this case, why don't you put those 4 pages in one file, and load the rest externally with cache disabled? ( each external page in a separate file). Does it make sense? – Omar Apr 15 '14 at 22:48

0 Answers0