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

标签 ios http url url-scheme

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

请大家帮忙

最佳答案

这是一个使用 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/

相关文章:

ios - 如何在可以沿此 webView 平移的 WKWebView 上添加 subview ?

javascript - 如何从xhr获取标题?

http - 是否有 HTTP 请求 header 指示浏览器需要低带宽或低功耗版本的网页?

angular - window.URL.createObjectURL [Angular 7/Typescript]

regex - Scala - 来自 URL 的 Youtube 视频 ID

android - 用于为不同智能手机操作系统开发应用程序的通用代码库

ios - AFNetworking UIImage NSURL

iphone - 稍后从UIImagePickerController压缩视频吗?

node.js - 乱码而不是 html 响应作为 node.request 中的正文

mysql - 如何统计MySQL中的URL域?