zoukankan      html  css  js  c++  java
  • js浏览器下载总结(ios、and、微信、qq)

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

    开始是判断微信、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版本问题,下载链接又出问题了

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

  • 相关阅读:
    C#如何释放未托管资源
    C# 如何将一个List转换为只读的
    【转载】所谓爱情不是一个人的事情(爱情不完全手册)
    vbs SendKey 用法 Sendkey 键盘对应的码表
    PowerShell签名和执行策略
    IDisposable接口和析构函数的联合使用
    [读报]2009中国基金业明星基金奖揭晓
    【读书笔记】泛型接口 和 泛型方法
    C# 反射(转)
    设计模式详解——装饰者模式
  • 原文地址:https://www.cnblogs.com/dingyufenglian/p/4831459.html
Copyright © 2011-2022 走看看