H5 アプリのウェイクアップ方法、H5 はアプリをウェイクアップしてダウンロード ページにジャンプできません

H5 アプリのウェイクアップ方法、H5 はアプリをウェイクアップしてダウンロード ページにジャンプできません



        let ua = window.navigator.userAgent.toLowerCase();

        let src =  {
            iphone: /iphone/i.test(ua),
            android: /android/i.test(ua),
            windows: /windows/i.test(ua),
            weixin: /micromessenger/i.test(ua)
        }


        // 安卓版微信
        if(src.weixin && src.android){
            window.location.href="APP下载地址"
        }

        // IOS版微信
        if(src.weixin && src.iphone){
            window.location.href="APP下载地址"
        }


        // 安卓浏览器
        if(src.android && !src.weixin  ){

            // window.location.href="javascript:window.location.href='weixin://'"
            window.location.href="javascript:window.location.href='android://安卓包名'"

            setTimeout(function(){
                window.location.href="APP下载地址"
            },3000)
        }

        // IOS浏览器
        if(src.iphone && !src.weixin){

            window.location.href="javascript:window.location.href='schemes协议地址'"

            setTimeout(function(){
                window.location.href="APP下载地址"
            },3000)

        }
        if(src.windows){
            window.location.href='官网'
        }

        if(!src.android && !src.iphone && !src.windows){
            window.location.href='官网'
        }

参考リンクhttp://www.nodebook.top/#/text/5f1ce15efd7696233d2dc084

おすすめ

転載: blog.csdn.net/u012118993/article/details/115030272