• 微信判断手机有没有APP,有则打开,没有则跳到应用商城


    微信 点击  按钮,判断手机是否有本公司APP,有则打开,没有则跳转到应用商城。

    很不开心的是:微信会阻止打开外部APP,所以,安卓要跳到 应用宝市场  去打开。IOS跳到APP Store

    IOS可以提示用户用Safari打开。

    安卓也可以提示用其他浏览器打开,虽然体验不好。

    <a id="downAPP>去下载APP</a>
    
    
    
     // 去下载APP
                $('#downAPP').on('click',function () {
                   downApp.downloadAppT();//先判断是苹果设备还是安卓,调用各自的函数。
                });
    
        var downApp = {
             //判断是否为IOS设备
            browserType:function () {
                var userAgentInfo = navigator.userAgent;
                var Agents = new Array("iPhone","iPad", "iPod");
                var flag = false;
                for (var v = 0; v < Agents.length; v++) {
                    if (userAgentInfo.indexOf(Agents[v]) > 0) {
                        flag = true;
                        break;
                    }
                }
                return flag;
            },
            <!--下载APP-->
            downloadAppT:function () {
                if ( this.browserType() ) {
                    this.iosFn();
                }else{
                    this.androidFn();
                }
            },
            // 安卓打开APP或者下载
            androidFn:function () {
                window.location.href ="";//这里写APP链接,安卓同事会给。找到就打开APP,找不到就跳到下面链接
                window.setTimeout(function(){
                    window.location.href = "";//没有本地APP的,就打开输入的网址。    去下载APP的网址
                    //微信不让打开外部APP,必须跳到类如应用宝(QQ所属产品)的市场,应用宝会判断本机有没这个APP,有就可以直接打开。
                },2000);
            },
            // IOS打开APP或者下载
            iosFn:function () {
                    <!--微信的话会阻止打开本地APP,那就跳到APP store,在里面打开。-->
                    var ifr = document.createElement("iframe");
                    ifr.src = "输入IOS给的链接";
                    ifr.style.display = "none";
                    document.body.appendChild(ifr);
                    window.setTimeout(function(){
                        document.body.removeChild(ifr);
                        window.location.href = "输入IOS给的链接";/***下载app的地址***/
                    },2000)
            }
        }
  • 相关阅读:
    std::auto_ptr
    make_pair
    _stdcall与_cdecl(了解)
    函数名与函数指针(了解)
    空指针与野指针
    std::bind(二)
    C++ map 映照容器
    sql find duplicate
    数量
    sort sign numeric
  • 原文地址:https://www.cnblogs.com/xiaoxiaossrs/p/7521797.html
Copyright © 2020-2023  润新知