首页 > 解决方案 > 从浏览器打开的原生移动应用 (iOS 13)

问题描述

我在网站上有一个代码,它正在检查用户代理并根据操作系统导航到本机应用程序。

function openPage(webUrl, appUrl) {
    var loadedAt = +new Date;
    var interval = setInterval(function () {
        var res = +new Date - loadedAt;
        if (res > 1000) {
            clearInterval(interval);
            // Try launching the website which will navigate you into the app store
            window.location.href = webUrl;
        }
    }, 250);
    // Try launching the app using URL schemes
    window.location.href = appUrl;
}

在 iOS v13 之前一切正常。现在,如果用户访问我的网站,那么将在手机上打开第一个本机应用程序,然后使用此应用程序打开应用商店。知道如何解决这个问题吗?

标签: javascriptmobile-safarideep-linkingios13url-scheme

解决方案


推荐阅读