Reputation: 14370
I am creating a webapp using phonegap and jquerymobile. When i am using changePage to go to other page then it is not working.Here is my code
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width; user-scalable=no" />
<script type="text/javascript" charset="utf-8" src="phonegap-1.4.1.js"></script>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<link rel="stylesheet" href="jquery.mobile-1.0.1.min.css" />
<script type="text/javascript" src="jquery.mobile-1.0.1.min.js"></script>
</head>
<script type="text/javascript">
function clickEvent()
{
$.mobile.changePage("account_page.html", null, true, true);
}
</script>
<body>
<div style="top: 0; left: 0; position: absolute; z-index: 1;">
<img src="images/login_screen.JPG" alt="login_screen" width="320" onclick="clickEvent()"/>
</div>
</body>
</html>
But when i use
window.location.href = 'file:///android_asset/www/account_page.html';
Then it is working...Why is it so?
Upvotes: 2
Views: 4784
Reputation: 7655
$.mobile.changePage doesnt load another html into view. it scans the html in the html whose link u gave, gets the first jqm 'page' on it and adds that into the dom(not the entire html)
If this is not what you intended to do and wanted to load the full account_page.html into the dom then u'll have to use either
window.location.href or navigator.app.loadUrl
Upvotes: 9