iOS Web App的后台行为(因此应用程序不会重新启动) [英] Background behavior for iOS Web App (so app doesn't restart)

查看:226
本文介绍了iOS Web App的后台行为(因此应用程序不会重新启动)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个移动网络应用程序,并且对支持apple-mobile-web-app-appable"的选项很感兴趣,从而使该应用程序看起来更加原生.

I'm trying to build a mobile web app and am intrigued by the "apple-mobile-web-app-capable" option, making the app feel a lot more native.

我遇到的问题是,它是一个允许用户浏览一堆内容的应用程序,其中一些内容(故意)在Web应用程序外部打开了一个新的浏览器窗口.问题是,当用户返回到Web应用程序时,它将重新启动并从主页启动它们.

The issue I'm having is that it's an app that lets a user browse through a bunch of content, some of which opens a new browser window outside the web app (on purpose). The problem is, when a user goes back to the web app, it re-launches and starts them from the home page.

有人找到避免这种完全重新加载过程的方法吗?

Has anyone found a way to avoid this complete reloading process?

推荐答案

ive使它像这样工作:

ive got it working like this:

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;
    }
}

这篇关于iOS Web App的后台行为(因此应用程序不会重新启动)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆