Restart my Phonegap app programmatically

☆樱花仙子☆ 提交于 2019-11-28 22:38:22

I use the following:

location.reload(); 

Works a treat for me.

Paul

user3210388

Try this

navigator.app.loadUrl("file:///android_asset/www/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000});

Bakri

This works for iOS and Android (at least with 2016 platform versions). It works also in SPA applications.

// keep startup url (in case your app is an SPA with html5 url routing)
var initialHref = window.location.href;

function restartApplication() {
  // Show splash screen (useful if your app takes time to load) 
  navigator.splashscreen.show();
  // Reload original app url (ie your index.html file)
  window.location = initialHref;
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!