从微信端跳到外部浏览器进行apk文件下载

需求:从微信里跳到外部浏览器进行apk文件下载

原因:在微信内不允许直接下载apk
微信中提示在浏览器中打开

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=no, width=device-width" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <!--<link rel="stylesheet" type="text/css" href="__CSS__/ionic.min.css"> -->
    <link rel="stylesheet" type="text/css" href="css/swiper.min.css">
    <link rel="stylesheet" type="text/css" href="css/wx.css">
    <title>下载APP</title>
</head>
<style>
    *{
        margin:0px;
        padding:0px;
    }
    body{
        background:#fff;
        /*overflow:hidden;*/
    }
    #weixin-tip img{
        width:100%;
    }
    #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{position:relative;width:90%;margin:0 auto;}
    #weixin-tip .close{color:#fff;padding:5px;font:bold 20px/24px simsun;text-shadow:0 1px 0 #ddd;position:absolute;top:0;left:0;}
</style>
<body>
    <a id="J_weixin" href='文件下载地址'>
    <div id="weixin-tip"><p><img src="__STATIC__/index/lib/tp_1.png" alt="微信打开"/><span id="close" title="关闭" class="close">×</span></p></div>
</body>
<script>
    var is_weixin = (function(){return navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1})();
    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';
            }
        }
    }
    // var remap=document.getElementById('remap');
    //    remap.style.height=(winHeight-20) + 'px';     
</script>
</html>

 

 

亲测没有问题。

 

 

方案2:用FishJump工具http://www.fishtool.cn/
FishJump工具可以省去以上步骤,在微信中打开连接后,会自动跳到外部浏览器进行下载

FishJump工具使用教程:


①:输入需要在微信中打开的网址链接。

②:点击生成按钮,生成转换后的链接和二维码。

③:复制生成后的链接或者扫一扫二维码即可。

转载于:https://www.cnblogs.com/bky4321/p/10889627.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值