I am using Jquery1.8.2 and Jquery-mobile 1.1
When i click on Logout button i have to goto the Home page. I am able get the home page but before going back to the home page got the "Error Loading Page" message.
Test.html
<body>
<div data-role="page">
<div data-role="header" data-theme="b" >
<h1> Success Page </h1>
<a data-role="button" id="logoutbtn" data-theme="b">Logout</a>
</div><!-- /header -->
<div data-role='content'>
</div>
</div>
</body>
test.js
$(document).ready(function(){
$("#logoutbtn").click(function () {
document.location.href = "Home.html";
});
});
Please help me out on this.
You should be using the jquery mobile specific methods.
$.mobile.changePage("Home.html");
See document-location-href-location-vs-mobile-changepagelocation
Thanks Dipaks
Instead of
document.location.href = "/Home.html";
I have modified it as like below
document.location.href = "./Home.html";
Its working fine and able to go back to home page with out any error.
$.mobile.changePage("Home.html")
did not work on my PC
but instead $.mobile.changePage("#");
works and it's hiding the error loading page
message.
I was using the right versions and $.mobile.changePage to change a page and it still failed with the same error. Later I realized that I was doing this in a js file in www/js/custom/handler/handler.js. So I was using paths relative to this location.
However later I realized that the path has to be relative to index.html that includes this js.
That resolved my issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.