如何从浏览器打开iOS应用程序?

时间:2014-04-15 07:40:24

标签: ios http url url-scheme

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

之类的http链接时打开我的应用程序

任何人请帮助

1 个答案:

答案 0 :(得分:4)

以下是使用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);
        }

    });
相关问题