js浏览器下载总结(ios、and、微信、qq)
2015-09-23 10:23
761 查看
前段时间做了个项目,里面关于手机移动端下载的问题
开始是判断微信、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版本问题,下载链接又出问题了
出现了加密和解密的问题,我要怎么解决,我去。
开始是判断微信、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版本问题,下载链接又出问题了
出现了加密和解密的问题,我要怎么解决,我去。
相关文章推荐
- 【干货】微信场景之H5页面制作免费工具大集合
- 微信,能为企业带来多大的价值?
- wemall微信商城 wemall三级分销 O2O 生鲜 支付宝支付
- php 微信刮刮卡
- iOS9 微信支付支付宝支付适配
- 苹果开发 笔记(81)ios 调用微信分享链接
- Android微信支付之免jar包集成方式(简单至极)
- 升级了xcode7 & ios9调微信API提示未安装微信客户端解决方案
- 001.Hello World
- Servlet页面注册用户的小程序(一)
- 第三方分享(新浪,微信,QQ)
- 微信开发 -- 企业付款 PHP代码实现
- 获取分享到微信的缩略图 thumbData
- 挖掘微信Web版通信的全过程
- 微信企业号开发
- 计算器小程序
- 微信支付功能的实现过程
- java判断身份证信息小程序(无图形界面)
- 微信
- 微信扫描打开APP下载链接提示代码优化