app下載中間頁面_微信不能直接下載的處理方法


一:JS判斷是否是微信瀏覽器

function is_weixin() {
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
return true;
} else {
return false;
}
}

 

window.onload = function () {
var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight; //兼容IOS,不需要的可以去掉
var btn = document.getElementById('J_weixin');
var tip = document.getElementById('weixin-tip');
var close = document.getElementById('close');

if (is_weixin()) {
btn.onclick = function (e) {
tip.style.height = winHeight + 'px'; //兼容IOS彈窗整屏
tip.style.display = 'block';
return false;
}
close.onclick = function () {
tip.style.display = 'none';
}
}
else
{
btn.onclick = function (e) {
window.open("XX", "_self");
}
}
}

二:頁面彈出層

<div id="weixin-tip"><p><img src="images/live_weixin.png"alt="微信打開" /><span id="close" title="關閉" class="close">×</span></p></div>

三:關閉層樣式

#weixin-tip{display:none;position:fixed;left:0;top:0;background:rgba(0,0,0,0.8);filter:alpha(opacity=80);width:100%;height:100%;z-index:100;}
#weixin-tip p{text-align:center;margin-top:10%;padding:0 5%;position:relative;}
#weixin-tip .close{color:#fff;padding:5px;font:bold 20px/24px simsun;text-shadow:0 1px 0 #ddd;position:absolute;top:0;left:5%;}

四:圖標

 

參考地址http://caibaojian.com/weixin-tip2.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM