如何从浏览器打开iOS应用程序? [英] How to open iOS app from browser?

查看:308
本文介绍了如何从浏览器打开iOS应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have to open my iOS app whenever user open a link of my app in browser. I have already used a like myApp:// but i want to open my app even when user open an http link a from browser. Just like pinterest. Pinterest opens app even if i open a regular http link like this http://www.pinterest.com/pseudoamber/ and using URL scheme as well like this pinterest://www.pinterest.com/pseudoamber/. My app is opening on myApp://www.myapp.com now i want to open my app when user open an http link like this http://www.myapp.com

任何人请帮助

推荐答案

以下是使用jQuery的示例:

Here is an example using 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应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆