Reputation: 5890
Hi for navigating from one page to another i used $.mobile.changePage('test.html');
. This works fine in android,symbian and blackberry6+.But I also want my application to run on blackberry5. Blackberry5 does not support ajax and therefore $.mobile.changePage('test.html');
not work for it.
For this reason I use window.open("test.html");
and window.location.href = "test.html";
Here it works perfectly in all platform including blackberry4.6+ also. But now problem is I have header in test.html as:
<div data-role="header" align="center">
<a href="#" data-rel="back" data-icon="arrow-l">Back</a>
<h1>Test.html</h1>
<a href="MainMenu.html" data-icon="grid">Menu</a>
</div>
But here now back button is not working. If I use $.mobile.changePage('test.html');
for navigation then back button works perfectly but not with window.open("test.html");
and window.location.href = "test.html";
.
Therefore I use session and on click of back button I call page forcefully. as:
<script type="application/javascript">
function redirect(url)
{
alert("inside redirect:"+url);
window.location = url;
}
</script>
<div data-role="navbar">
<ul>
<li> <a onclick="redirect( getCookie('paged'))" data-icon="back" data-iconpos="notext" data-direction="reverse" class="ui-btn-left jqm-home">Back</a></li>
<li> <a onclick="redirect(getCookie('paged'))" data-icon="back" data-iconpos="notext" data-direction="reverse" class="ui-btn-left jqm-home">Back</a></li>
</ul>
</div>
Here now back button also works perfectly but when I click on hardware back button then it again goes to previous pages from where it came.
How I can use $.mobile.changePage(...)
without ajax so I can use it for all platforms including blackberry4.6+
Any suggestion will be appreciated. Thanks in advance.
Upvotes: 1
Views: 6078
Reputation: 792
I have tried this two solutions, both worked for me:
window.location.href = yourpageurl;
or
$.mobile.ajaxEnabled = false;
$(":mobile-pagecontainer").pagecontainer( "change", yourpageurl);
Upvotes: 0
Reputation: 17247
I've tried to disable ajax using the Global Config but it didn't work out for me for some reason.
I tried as below and it worked
window.location.href="myfile.html";
Upvotes: 1
Reputation: 681
You can use this function.
$.mobile.changePage('#gototestpage');
But there is some restriction. You will have to keep the code in same page in another div like so,
<div id="gototestpage"> --- Your Code here ----- </div>
Upvotes: 0
Reputation: 2854
Have you tried setting the global property $.mobile.ajaxEnabled
to false
? See http://jquerymobile.com/demos/1.1.1/docs/api/globalconfig.html. It is written that "jQuery Mobile will automatically handle link clicks and form submissions through Ajax, when possible". I am not sure now if it does also affect $.mobile.changePage
, but maybe it is worth a try...
Upvotes: 0