Kjelle J
Kjelle J

Reputation: 197

jQuery Mobile on Android: page load

I have a web application that runs just fine on Android until I started to use jQM. It still runs fine with jQM on the desktop...

The problem is that when I load a "new URL" using "window.location.href = newLocation;" the new page loads fine the first time but the next time the page is displayed ok but then disappears and I can just see the header and footer of the first page (not the second). When I refresh I see the second page ok. Another way to have it working is to always refresh the first page b4 launching the second.

I have tried to disable page transition and Ajax but with no success.

If I run (I guess it is stupid): $.mobile.changePage(newLocation, { transition: "none"}); window.location.href = newLocation;

it always works but then I sometimes get "Error loading page".

Any ideas? $.mobile.changePage(newLocation, { transition: "none"}); alone does not work...

Upvotes: 0

Views: 210

Answers (1)

Kjelle J
Kjelle J

Reputation: 197

Here is a "bypass" solution. It works but there may be better ones...

First I tried to add some JS to force a reload of the first page when coming back from the second but no JS executed...

Then I saw After travelling back in Firefox history, JavaScript won't run and just added "window.onunload = function(){};" to the first page. This prevents caching of the first page and now things are working.

It looks like page caching was causing the problem but I don't know why this means that jQM fails...

Upvotes: 1

Related Questions