今天要加的是一個終極解決方法:彈出一個遮罩提示用戶在新的瀏覽器窗口打開。
再也不用管微信如何的更新,直接判斷微信的ua,然后彈出一個遮罩提示用戶在瀏覽器中打開下載。並且不加關閉的按鈕。類似於下面這樣子:

這樣子用戶就只能在瀏覽器中打開,並且可以直接下載應用了。歡迎打開微信掃描查看(其他掃描沒有效果)。
演示二維碼:

源碼:
<!DOCTYPE html> <html lang="zh_CN"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"/> <script type="text/javascript" src="http://libs.useso.com/js/jquery/1.9.0/jquery.min.js"></script> <title>點擊下載應用</title> <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> </head> <body> <br/><br/> <div><center><a id="download_app" href="../up_file/xyy.apk"><img src="images/xyy_icon.png" alt="下載洗洋洋"/><br/>下載洗洋洋</a></center></div> <div class="weixin-tip"> <p> <img src="images/live_weixin.png" alt="微信打開"/> </p> </div> <script type="text/javascript"> $(window).on("load",function(){ var winHeight = $(window).height(); $("#download_app").hide(); function is_weixin() { var ua = navigator.userAgent.toLowerCase(); //alert(ua); //瀏覽器 mozilla/5.0 (windows nt 6.1) applewebkit/537.36(khtml,like gecko) chrome/41.0.2272.12 safari/53736 //微信 mozilla/5.0 (linux;u;android 4.4.2;zh-cn;coolpad 8675 build/kot49h) applewebkit/533.1 (khtml,like gecko)version/4.0 mqqbrowser/5.4 tbs/025440 mobile safari/533.1 micromessenger/6.2.4.53_r843fb8e.600 nettype/wifi language/zh_cn 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(); }else{ $("#download_app").show(); } }) </script> </body> </html>
遮蓋層圖片:

本文參考自:http://caibaojian.com/weixin-tip.html
用的是版本三
