Reputation: 137
I have an app built with jquery mobile and packaged with phonegap. I'm running into the problem where if a user is to start my application in airplane mode (or just without a network connection) then turns a connection on / gains a connection google maps will not load, unless of course killing the app completely and relaunching.
The method I tried to resolve this was just reloading the page using the following...
if(checkOnlineStatus()){
$.mobile.changePage( './index.html',
{
allowSamePageTransition : true,
transition : 'none',
showLoadMsg : false,
reloadPage : true,
changeHash : false
}
);
}
else{
alert("Application requires a network connection. Please check your settings and retry.");
}
This doesn't seem to reload any scripts whether I include them in the data-role="page" or not. I'm storing google maps script right before the </body>
tag although I've tried this method storing it in the page element as well.
Any help would be appreciated.
Upvotes: 1
Views: 111
Reputation: 137
This is a last-resort solution and won't work for everyone, but in my case it works fine. I replaced the changePage with an entire reload of the window...
window.location.reload(true);
This forces a fresh reload from the server.
Upvotes: 1