微信公眾號手機無法直接下載APK文件是怎麽回事
阿新 • • 發佈:2019-01-13
key tag cpu cto rip height 但是 content blank
現在微信分享的功能很多,從分享的鏈接下載apk安卓包是很正常的,但是微信不讓下載apk包,只能通過瀏覽器來下載,
在需要下載的頁面中加入下面的代碼
- <div class="weixin-tip" style="display:none;">
- <p>
- <img src="/images/weixin-tip.jpg" class="weixinpic" alt="微信打開"/>
- </p>
- </div>
css樣式
-
a{text-decoration
- .weixinpic{width: 100%; height: 100%;}
- .weixin-tip{display: none; position: fixed; left:0; top:0; bottom:0; background: rgba(0,0,0,0.8); filter:alpha(opacity=80); height: 100%; width: 100%; z-index: 100;}
- .weixin-tip p{text-align: center;}
js
-
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"
- <script type="text/javascript">
- $(function(){
- var u = navigator.userAgent, app = navigator.appVersion;
- var isAndroid = u.indexOf(‘Android‘) > -1 || u.indexOf(‘Linux‘) > -1;
- var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
-
$(‘.img‘
- if(isAndroid){
- var winHeight = $(window).height();
- function is_weixin() {
- var ua = navigator.userAgent.toLowerCase();
- if (ua.match(/MicroMessenger/i) == "micromessenger") {
- return true;
- } else {
- return false;
- }
- }
- var isWeixin = is_weixin();
- if(isWeixin){
- $(".weixin-tip").css("height",winHeight);
- $(".weixin-tip").show();
- }else {
- window.location.href = "";//安卓下載地址
- }
- }else if(isIOS){
- location.href = ‘‘;//IOS下載地址
- }
- })
- })
- </script>
這要就可以下載了
微信公眾號手機無法直接下載APK文件是怎麽回事