js浏览器问题

前段时间做了个项目,里面关于手机移动端下载的问题

开始是判断微信、ios和android系统的下载

因为微信屏蔽点击事件和链接的缘故,需要通过打开新页面来进行下载

ios和android的下载分别为不同的问题。代码如下:

<script type="text/javascript">
var is_weixin = (function() {
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {//判断浏览器是否是微信
return true;
} else {
return false;
}
})();
window.onload = function(){
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; 
var isiOS = !!u.match(/(i[^;]+;( U;)? CPU.+Mac OS X/);
var down = document.getElementById('J_weixin');
var down2 = document.getElementById('J_weixin00');
if (isAndroid){
down.setAttribute("href", "http://120.26.207.142:8080/WeizhifuAPI/GetNewVersionFile");
down2.setAttribute("href", "http://120.26.207.142:8080/WeizhifuAPI/GetNewVersionFile");
}
if (isiOS){ 
down.setAttribute("href", "itms-services://?action=download-manifest&url=https://vinpush2012.sinaapp.com/plist/wtx.plist");
down2.setAttribute("href", "itms-services://?action=download-manifest&url=https://vinpush2012.sinaapp.com/plist/wtx.plist");
}

var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight;
var btn = document.getElementById('J_weixin');
var btn2 = document.getElementById('J_weixin00');
var tip = document.getElementById('weixin-tip');
var close = document.getElementById('close');

if(is_weixin){
btn.onclick = function(e){
tip.style.height = winHeight + 'px';
tip.style.display = 'block';
return false;
}
btn2.onclick = function(e){
tip.style.height = winHeight + 'px';
tip.style.display = 'block';
return false;
}
close.onclick = function(){
tip.style.display = 'none';
}
}

}

</script>

然后问题解决了,你觉得万事大吉了,真是太天真了!!!!

上线以后,问题又来了。

因为ipad和ipone版本问题,下载链接又出问题了

出现了加密和解密的问题,我要怎么解决,我去。

原文地址:https://www.cnblogs.com/dingyufenglian/p/4831451.html