OGeek|极客世界-中国程序员成长平台

标题: ios - 如何从浏览器打开 iOS 应用程序? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 07:28
标题: ios - 如何从浏览器打开 iOS 应用程序?

每当用户在浏览器中打开我的应用程序链接时,我都必须打开我的 iOS 应用程序。我已经使用了类似的 myApp:// 但即使用户从浏览器打开 http 链接,我也想打开我的应用程序。就像 pinterest 一样。即使我打开像这样 http://www.pinterest.com/pseudoamber/ 这样的常规 http 链接并使用像这样 pinterest://www.pinterest 这样的 URL 方案,Pinterest 也会打开应用程序.com/pseudoamber/。我的应用程序正在 myApp://www.myapp.com 上打开,现在我想在用户打开这样的 http 链接时打开我的应用程序 http://www.myapp.com

请大家帮忙



Best Answer-推荐答案


这里是一个使用 jQuery 的例子:

$(document).ready(function() {

        var user_agent_header = navigator.userAgent;

        if(user_agent_header.indexOf('iPhone')!=-1 || user_agent_header.indexOf('iPod')!=-1 || user_agent_header.indexOf('iPad')!=-1){
            setTimeout(function() { window.location="myApp://www.myapp.com";}, 25);
        }

    });

关于ios - 如何从浏览器打开 iOS 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23077411/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4