When using wechat to open the website, you cannot open the commonly used download software, mobile APP, etc. in wechat. All kinds of wechat circulated on the Internet open download links, wechat update basic failure. The common method is to pop up a mask to prompt users to open in a new browser window, and never mind how wechat is updated.
Judge the ua of wechat directly. If it is opened in wechat built-in browser, a mask will pop up to prompt the user to open the download in the browser without closing the button. In this way, the sub user can only open in the browser, and can download the application directly.
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="WeChat opens"/>
</p>
</div>
JS code
<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>
There is a herl tool, which can automatically open the mobile browser to download the APP in wechat.
1. herl tool website: http://www.fishtool.cn
2. Fill in the address of the downloaded apk or download page link
3. Click one button to generate a QR code and a link address (two are the same address, select according to your needs)
4. The generated QR code or link can be tested by scanning with wechat or opening the connection with wechat
If you have better solutions or tools, welcome to share!