-
-
Save scottjehl/1037934 to your computer and use it in GitHub Desktop.
/* Dynamically create a page and navigate to it. | |
(and include the page in browser history ) */ | |
//create markup | |
var newPage = $("<div data-role=page data-url=yay><div data-role=header><h1>YAY!!!!</h1></div><div data-role=content><img src=http://bukk.it/yay.gif /></div></div"); | |
//append it to the page container | |
newPage.appendTo( $.mobile.pageContainer ); | |
//go to it | |
$.mobile.changePage( newPage ); |
The data-url is required for the browser history, so the browsers "back" button works correctly. Its value is insignificant it just has to be there.
If I set the data-url attribute and press the back button, it produces the following error:
PhoneGapLog(480): file:///android_asset/www/js/phonegap-1.1.0.js: Line 930 : JSCallback Error: Request failed.
Any idea? Thanks.
EDIT:
Updating to phonegap 1.2 and JQM 1 dit not solved my problem.
Thank you so much! This finally worked for me!
@hypept
Any luck with that? I'm getting the same problem with PhoneGap 1.2 and JQM 1.0
I only got it to work without any problems with PhoneGap 1.3!
Thank you for sharing! Works like a charm.
Thank you! Does exactly what I was looking for.
Thanks in advance, i want to replace the page. Can you upload the code for replace?
Is the data-url attribute important?