Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to refresh your phonegap application - eg, build the page and start running the scripts from the beginning?

Is there any way to do this?

E.g., if a user starts the app with no internet connection, no remote scripts can be loaded, and the application basically can't run and I display a "No internet" page. But if the user gets internet later and the application is still running, is there any way to just "restart" ?

like image 358
Justin Avatar asked Dec 14 '11 02:12

Justin


2 Answers

how about -

document.location = "index.html"

PhoneGap applications are just like an embedded website - you should be able to go to any hyperlink you wish (mind the whitelists).

Of course, if you also want to detect when it's again online, you should use the PhoneGap Network API to bind to those online/offline events.

In general thought, have you ever thought of using the HTML5 manifest functionality to actually let your local PhoneGap app cache those remote scripts? That way your app could still run, even when offline (except if it needs remote data to "do your thing")...

Hope this helps!

like image 197
Leon Avatar answered Nov 03 '22 06:11

Leon


Try this

navigator.app.loadUrl("file:///android_asset/www/index.html", {wait:2000,  loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000});
like image 1
user3210388 Avatar answered Nov 03 '22 08:11

user3210388