<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>手機APP下載頁</title>
<script type="text/javascript">
var theUrl;
// 獲取終端的相關信息
var Terminal = {
// 辨別移動終端類型
platform : function(){
var u = navigator.userAgent, app = navigator.appVersion;
return {
// android終端或者uc瀏覽器
android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,
// 是否為iPhone或者QQHD瀏覽器
iPhone: u.indexOf('iPhone') > -1 ,
// 是否iPad
iPad: u.indexOf('iPad') > -1 ,
// 是否是通過微信的掃一掃打開的
weChat: u.indexOf('MicroMessenger') > -1
};
}(),
// 辨別移動終端的語言:zh-cn、en-us、ko-kr、ja-jp...
language : (navigator.browserLanguage || navigator.language).toLowerCase()
}
// 根據不同的終端,跳轉到不同的地址
if(Terminal.platform.android){
theUrl = '你的Android APP對應下載地址:apk文件地址';
}else if(Terminal.platform.iPhone){
theUrl = '你的iPhone APP對應下載地址:APP Store地址';
}else if(Terminal.platform.iPad){
// 還可以通過language,區分開多國語言版
switch(Terminal.language){
case 'en-us':
theUrl = '你的iPad APP(英文版)對應下載地址:APP Store地址';
break;
case 'ko-kr':
theUrl = '你的iPad APP(韓語版)對應下載地址:APP Store地址';
break;
case 'ja-jp':
theUrl = '你的iPad APP(日文版)對應下載地址:APP Store地址';
break;
default:
theUrl = '你的iPad APP(中文版-默認)對應下載地址:APP Store地址';
}
}
location.href = theUrl;
// 分割線-----------------------------------------------------------分割線
// 如果要分渠道,也是可以的,渠道區分:from=xx
var From = (function(){
var searchInfo = location.search.substr(1).split('&'),
item,
from;
for(var i= 0,len=searchInfo.length;len > 1 && i<len;i++){
item = searchInfo[i].split('=');
if(item[0] === 'from') {
from = item[1];
break;
}
}
return from;
})();
// 根據不同的終端,跳轉到不同的地址
var theUrl;
// 以安卓為例
// 另外:微信掃一掃后打開連接,是不能直接進行下載的,所以你可以將apk放到微云上,使用微云上的apk地址
if(Terminal.platform.android){
// 這里區分渠道
switch(From){
case 'baidu':
if(Terminal.platform.weChat) {
theUrl = '你的App:微云上的地址';
}else{
theUrl = '你的APP:baidu定制版';
}
break;
case 'google':
if(Terminal.platform.weChat) {
theUrl = '你的App:微云上的地址';
}else{
theUrl = '你的APP:google定制版';
}
break;
default:
if(Terminal.platform.weChat) {
theUrl = '你的App:微云上的地址';
}else{
theUrl = '你的APP:官方版';
}
}
}
location.href = theUrl;
</script>
</head>
<body>
</body>
</html>
掃碼下載app
最后編輯于 :
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
推薦閱讀更多精彩內容
- 在安裝Xubuntu16.04時,使用的簡體中文,是為了方便安裝搜狗輸入法,但是安裝完,設置系統語言為英文后,鼠標...