H5唤醒APP方法,H5唤醒不了App跳下载页

H5唤醒APP方法,H5唤醒不了App跳下载页



        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