chimpuz
chimpuz

Reputation: 23

jQuery Mobile Change page not loading page already in DOM

I am loading an JqueryMobile Page Home in my application and on pageinit I am navigating to web/mobile external page (say B) using $.mobile.changePage('webWatch.html'...

Now, when I am trying to changePage from B to Home, which is already in DOM and attributed as data-dom-cache=true, there is nothing happening. I am not getting any error or action on the page.

Any suggestions how to get this thing work.

Thanks.

Upvotes: 2

Views: 1547

Answers (1)

Jasper
Jasper

Reputation: 75993

Use absolute URLs so the URL you ask for matches the data-url attribute of the page.

For example, if a file is in the /watch/ folder (within the root directory of your account), you can setup it's data-url attribute before jQuery Mobile does:

<div data-dom-cache="true" data-role="page" data-url="/watch/default.html">
    ...
</div>

This way you know it's setup correctly and you don't have to worry about the relativity of assets. Then when you link to the page use the absolute URL:

<a data-role="button" href="/watch/default.html">Go to /watch/default.html</a>

This way when you click the Go to /watch/default.html link, jQuery Mobile will search the current pseudo-pages for the one with the data-url attribute that matches the href attribute of the link.

Upvotes: 1

Related Questions