到這個 入門 15 ,有可能你的app基本上該有的都有了,可以發佈了,App Store 這個你只能聽Apple 的,如果是android 的,雖然這個是一個間接避免的方式,但仍然不建議,因爲國內的幾個應用商城都不嚴格的,添加吧,方便,別跟他們鬥氣了
由於微信中打開如果是apk的地址,則無法下載,必須是應用寶內的apk,繞過微信實在是太費勁,再說,人家的用戶量多,強勢!任性!
參考網絡一種相對聰明的做法,引導客戶去下載,只是多一個步驟而已
代碼如下
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title id="title">下載</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="img/jquery-1.10.2.min.htm"></script>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
img {
max-width: 100%;
height: auto;
}
.test {
height: 600px;
max-width: 600px;
font-size: 40px;
}
</style>
</head>
<body>
</body>
<script>
function is_weixin() {
var ua = navigator.userAgent.toLowerCase();
//alert(ua);
if (ua.match(/MicroMessenger/i) == "micromessenger") {
if (ua.match(/iphone/i) == "iphone" || ua.match(/ipad/i) == "ipad") {
window.location.href = "https://appstore對應app的地址";
return false;
}
else {
return true;
}
} else {
if (ua.match(/iphone/i) == "iphone" || ua.match(/ipad/i) == "ipad") {
window.location.href = "https://appstore對應app的地址";
return false;
}
else {
window.location.href = "http://apk下載地址";
return false;
}
}
}
var isWeixin = is_weixin();
var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight;
var weixinTip = $('<div id="weixinTip"><p><img src="img/live_weixin.png" alt="微信打開"/></p></div>');
if (isWeixin) {
$("#title").html("請按下方指示操作");
$("body").append(weixinTip);
}
$("#weixinTip").css({
"position": "fixed",
"left": "0",
"top": "0",
"height": winHeight,
"width": "100%",
"z-index": "1000",
"background-color": "rgba(0,0,0,0.8)",
"filter": "alpha(opacity=80)",
});
$("#weixinTip p").css({
"text-align": "center",
"margin-top": "10%",
"padding-left": "5%",
"padding-right": "5%"
});
</script>
</html>
效果如下
你可以參考上面的代碼,放到服務器上,然後生成對應的二維碼,如下圖