我正在尝试构建一个移动网络应用程序,并且对“apple-mobile-web-app-capable”选项很感兴趣,这使应用程序感觉更加原生。
我遇到的问题是,它是一个允许用户浏览大量内容的应用程序,其中一些内容会在网络应用程序之外打开一个新的浏览器窗口(故意)。问题是,当用户返回 Web 应用程序时,它会重新启动并从主页启动它们。
有没有人找到避免这种完整重新加载过程的方法?
最佳答案
我让它像这样工作:
if(window.navigator.standalone === true) {
var lastpage = localStorage.getItem('exitsatus');
if (lastpage==null){
lastpage = "index.html";
}
if(document.referrer.length > 0 && document.referrer.indexOf("mysite.com") != -1){
var lastpageupdate = window.location;
localStorage.setItem('exitsatus',lastpageupdate);
} else {
window.location = lastpage;
}
}
关于mobile-website - iOS Web 应用程序的后台行为(因此应用程序不会重新启动),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5810648/