In Html5 I go to a specific page in the following manner:
window.location.href = "http://localhost:XXXX/MyPageName.html";
The href by clicking on the button does not work!! I have no idea why, it's the only way I could solve this problem.
When I run the html5 application using the PhoneGap, the links do not work (obviously, since there is no localhost to application)
How can I solve this problem?
In Html5 I go to a specific page in the following manner:
window.location.href = "http://localhost:XXXX/MyPageName.html";
The href by clicking on the button does not work!! I have no idea why, it's the only way I could solve this problem.
When I run the html5 application using the PhoneGap, the links do not work (obviously, since there is no localhost to application)
How can I solve this problem?
Share Improve this question asked Dec 3, 2012 at 13:12 Hodaya ShalomHodaya Shalom 4,42713 gold badges60 silver badges115 bronze badges3 Answers
Reset to default 2First, your links might not work, because cordova/phonegap blocks all external URLs by default. To fix this, read my answer here.
Second, Phonegap does not open a webserver, so http://localhost
is not correct. When you want to have an internal link, use something like <a href="/mydir/mypage.html">linkText</a>
.
You will solve your problems using something like this:
<script>
//action go to pageOther
$.mobile.changePage('#pageOther','slide');
</script>
<body>
<div data-role="page" id="pageHome">
//Your html
</div>
<div data-role="page" id="pageOther">
//Your html
</div>
</body>
See more info: http://jquerymobile./demos/1.2.0/docs/pages/page-anatomy.html
Phonegap suggest not having multiple pages. You should have "content" section in one page and then through the dynamic linking (using #page1 where page1 is the content area id)
Example.
all in same html page (index.html)
<div data-role="page" id="page0">
<a data-role="button" data-transition="slide" href="#page1">Page 1</a>
<div>
<div data-role="page" id="page1">
<div>
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744316396a4568204.html
评论列表(0条)