首页 文章

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

提问于
浏览
2

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

有人请帮忙

1 回答

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

相关问题