Hi all I am navigating from one html page to another as:
window.location = "test.html";
In test.html I have header as:
<script type="application/javascript">
function redirect()
{
alert("inside redirect:");
//window.location = url;
//history.back();
history.go(-1);
return false;
}
</script>
<div data-role="navbar">
<ul>
<li> <a href="#" data-theme="b" onclick="history.back(); return false;">Go Back</a></li>
<li> <a onclick="redirect()" data-icon="back" data-iconpos="notext" data-direction="reverse" class="ui-btn-left jqm-home">Back1</a></li>
</ul>
</div>
But here both back buttons (Go Back and Back1) are not working. If I use $.mobile.changePage('test.html')
to navigate between pages then both Back buttons work. Why they are not with windows.location?
I want to develop this application for B-Grade browser which are not support ajax. Therefore I cant use $.mobile.changePage('test.html')
.
Any help will be appreciated. Thanks.
Why not use
window.location.replace("test.html")
;try:
OR:
SEE REFERENCE
This Blackberry OS 5 browser has lots of issue. Initially i also tried to do what you are doing right now. But later i think so you will have to think of some other approach which is better. Here is how i solved it
First of all add these lines before loading the jquery-mobile script like this
Then i used the Single Html concept. In this concept i had to load my script just once and i could make use of jquery-mobile's
changePage
. When i had many html pages then i has to wait for some seconds as loading and unloading of scripts took place. Avoid that, Its unnecessarry.Have all the pages with in the same Html like this
Then after that you can easily do a
changePage
like thisI hope you take the right approach.
In jQuery mobile you can turn of ajax by setting some initiation variables. You need to load this script before you load jQuery mobile
With ajax turned off you can now still use your $.mobile.changePage().
Now to create a back button all you have to do is give the link an attribute of data-rel="back"