將APK的下載路徑轉換為二維碼用微信掃一掃無法下載的問題
想必在網上一搜肯定可以搜到解決微信掃碼下載apk的方法
今天嘗試了一下用到了快捷的方法,其它的需要審核什么的太麻煩,感覺這個體驗差不到哪里去
中間頁引導法
第三方的亂七八糟的別試了基本就是浪費時間。
直奔中間頁引導法------------
掃完效果:
瀏覽器打開后:
源碼:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>XXXXApp</title>
</head>
<body>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
img {
max-width: 100%;
height: auto;
}
.drawDownAppText {
height: 100vh;
max-width: 100vw;
font-size: 32px;
text-align: center;
padding-top: 20%;
}
.drawDownAppText a {
text-decoration: none;
}
</style>
<div class="drawDownAppText">
<a href="http://xxxxxxxxxxxxxxxxxxx.apk">點擊下載xxxxxxxApp</a>
</div>
<div></div>
<script type="text/javascript">
function is_weixin() {
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
return true;
} else {
return false;
}
}
var isWeixin = is_weixin();
var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight;
function loadHtml() {
var div = document.createElement('div');
div.id = 'weixin-tip';
div.innerHTML = '<p><img src="live_weixin.png" alt="微信打開"/></p>';
document.body.appendChild(div);
}
function loadStyleText(cssText) {
var style = document.createElement('style');
style.rel = 'stylesheet';
style.type = 'text/css';
try {
style.appendChild(document.createTextNode(cssText));
} catch (e) {
style.styleSheet.cssText = cssText; //ie9以下
}
var head = document.getElementsByTagName("head")[0]; //head標簽之間加上style樣式
head.appendChild(style);
}
var cssText = "#weixin-tip{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{text-align: center; margin-top: 10%; padding:0 5%;}";
if (isWeixin) {
loadHtml();
loadStyleText(cssText);
}
</script>
</body>
</html>
將APK路徑改一下
還有一張圖:live_weixin.png
最后就是將這個靜態頁面放入服務器中,然后將此地址用草料等工具轉換成網址二維碼即可