How to achieve js evoke local micro letter APP

When using the micro-channel open the URL, you can not open the popular download software, mobile phones and other APP in the micro letter. Various micro letter circulated on the Internet to open the download link, a micro-channel basic update failure. We commonly used method is to bring up a mask prompts the user to open in a new browser window, no longer have to update the micro-channel tube how.

Direct determination of the micro-channel ua, if the micro-channel is open in built-in browser, the user is prompted to open up a mask in a browser to download, and shut down without a button. This way the user can only open in the browser, and can be downloaded directly applied.

css code

<style type="text/css">
    *{
        margin:0; 
        padding:0;
    }
    a{
        text-decoration: none;
    }
    img{
        max-width: 100%; 
        height: auto;
    }
    .weixin-tip{
        display: none; 
        position: fixed; 
        left:0; 
        top:0; 
        bottom:0; 
        background: rgba(0,0,0,0.8); 
        filter:alpha(opacity=80);  
        height: 100%; 
        width: 100%; 
        z-index: 100;
    }
    .weixin-tip p{
        text-align: center; 
        margin-top: 10%; 
        padding:0 5%;
    }
</style>

 

HTML code

<div class="weixin-tip">
    <p>
        <img src="live_weixin.png" alt="微信打开"/>
    </p>
</div>

 

JS代码

<script type="text/javascript">
    $(window).on("load",function(){
        var winHeight = $(window).height();
        function is_weixin() {
            var ua = navigator.userAgent.toLowerCase();
            if (ua.match(/MicroMessenger/i) == "micromessenger") {
                return true;
            } else {
                return false;
            }
        }
        var isWeixin = is_weixin();
        if(isWeixin){
            $(".weixin-tip").css("height",winHeight);
            $(".weixin-tip").show();
        }
    })
</script>

 

有个herl工具,是可以在微信中自动打开手机浏览器下载APP。

  1、herl工具网址:http://www.fishtool.cn

  2、填写下载的apk的地址,或者下载页链接

  3、点击一键生成,会自动生成二维码和一个链接地址(两个是同一个地址,根据你的需要选择)

  4、生成的二维码或者链接,用微信扫一扫或者用微信打开连接,就可以测试了效果了

 

  如果大家有更好的解决方案或者工具,欢迎推荐分享!

 

Guess you like

Origin www.cnblogs.com/fishjump/p/11105070.html