Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7609035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:04:26+00:00 2026-05-31T01:04:26+00:00

I am trying to avoid reloading as much as possible when browsing back and

  • 0

I am trying to avoid reloading as much as possible when browsing back and forth in my mobile webapp. JQuery Mobile seems to be designed for that but I am having troubles taming this behavior.

Basically, I have two pages (page1 and page2). page1 has a link to page2 and vice versa. The first time they are loaded, both pages (i) load data in ajax and (ii) change the DOM structure accordingly. I use a global var to avoid reloading the data, which works quite well.

Let’s say page1 (resp page2) has a DOM structure called dom10 (resp dom20) in the html and dom11 (resp dom21) after everything is loaded.

Here is my problem:

  • I load page1, the data is loaded and the DOM is changed from dom10 to dom11

  • I then click on <a href="page2">click</a>, page2 is loaded, the data is retrieved and the DOM is changed from dom20 to dom21. So far so good.

  • I then click on <a href="page1">click</a> to go back. The page is just as I left it with dom11. Wonderful, there were no GET call at all.

  • I finally click on <a href="page2">click</a> again and that’s where it hurts. The page is loaded again (GET call), the data is not retrieved but the dom is set back to dom20

I can keep on clicking back on forth and I always get the same behavior. Whenever I click on page1 I get the DOM just as I left it, whenever I click on page2 there is a GET call and the DOM is reloaded.

So here is my question, is there a way to prevent reloading a page that was already loaded in jQuery Mobile?

I can think of workarounds to have my DOM as I want but I would love to avoid unnecessary calls slowing down my app.

If you want to play around with it, you can try it there.

Thanks a lot for your help!

PS: Surprisingly, I don’t get the same behavior on Firefox and Chrome… I am afraid it is not so simple.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:04:27+00:00Added an answer on May 31, 2026 at 1:04 am

    By default jQM always makes an AJAX request for pages even if you’ve already visited it before. If you set $.mobile.page.prototype.options.domCache = true; then only will jQM not reload pages.

    If so you will need to set reloadPage to true when you call $.mobile.changePage if you need to refresh the page – otherwise the page will be stale.

    Becareful though, if you do this all your pages will be appended to the DOM resulting in a massive DOM which impacts performance – you’ll need to manage it all properly in your JS which is a different topic. But imagine doing an open-ended $(‘.myClass’) search when you have 20 pages in your DOM. I have more details in an older answer I wrote: Jquerymobile – $.mobile.changepage

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to avoid using Interface Builder as much as possible. At the moment
I'm trying to avoid the use of magic strings as much as I can,
I've got a program that is tailing a growing file. I'm trying to avoid
Trying to avoid the SomethingManager trap here... Let's say I'm going to write a
After trying to avoid JavaScript for years, Iv started using Query for validation in
I'm trying to avoid a composite control or using and ASCX by extending an
I'm trying to avoid code like this when reusing the same ViewUserControl in ASP.NET
I'm trying to avoid the memory leak in PHP. When I create a object
This is a follow on to this question . I am trying to avoid
I just started with Spring Web MVC. I'm trying to avoid file extenstions in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.