1. 程式人生 > >微信掃一掃安裝IOS或Android客戶端

微信掃一掃安裝IOS或Android客戶端



<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>安全下載</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no,minimal-ui">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<style type="text/css">
html,body,figure,h2,h3,dl,dt,dd,ul,li,p {
margin: 0; padding: 0; display: block;
}
* {
-webkit-tap-highlight-color:rgba(0,0,0,0);
}
body {
font-size: 16px;
font-family:"Microsoft YaHei", Helvetica, Arial, sans-serif;
background: #ff2d4b;
}


.up{
margin: 7px;
text-align: right;
}
.up img{
width: 25px;
height: 32px;
}


.tip{
margin: 0 12px;
padding: 9px 20px 7px 14px;
border-radius: 8px;
background: #fff;
}
.tip img{
float: left;
width: 40px;
height: 40px;
margin-right: 12px;
}


.tip p{
font-size: 0.9375em;
line-height: 1.5em;
}


.line1{
color: #333;
}


.line2{
color: #ff2d4b;
}
</style>
</head>
<body>
<div id="text">
<figure class="up" ><img src="http://webmap0.map.bdimg.com/static/mwaimai/zt/dl/images/up_7648023.jpg"></figure>
<div class="tip">
<img src="http://webmap0.map.bdimg.com/static/mwaimai/zt/dl/images/logo_aa1754d.jpg">
<p class="line1">下載應用請點選右上角按鈕選擇</p>
<p class="line2">[在瀏覽器中開啟]</p>
</div>
</div>
<script type="text/javascript">
function checkDevice(){
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) { 
return 'ios';
} else if (/(Android)/i.test(navigator.userAgent)) {
return 'android';
}
}
function addStat(obj) {
var da_src = obj.da_src,
da_act = obj.da_act,
da_trd = obj.da_trd,
t = (new Date()).valueOf();
url = "http://map.baidu.com/mobile/img/t.gif?newmap=1&t=" + t 
+ "&code=SAK&da_trd=" + da_trd 
+ "&da_src=" + da_src 
+ "&da_act=" + da_act
+ "&module=waimai&third_party=&resid=31&da_ver=2.1.0";


var img = new Image();
img.src = url;
return img;
}


function isWeixinBrowser(){
var ua = navigator.userAgent.toLowerCase();
return (/micromessenger/.test(ua)) ? true : false ;
}


function getParams(name) {
   var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
   var r = window.location.search.substr(1).match(reg);
   if (r != null) return decodeURIComponent(r[2]); return null;
   }


   function getValue(name){
   return getParams(name) == null ? "" : getParams(name);
   }




   //如果帶引數,則記錄到統計程式碼中
   // utm_medium = 推廣大類 如鳳巢,utm_campaign = 城市+時間,utm_term = 關鍵詞 ,packno = 包名, channel = 渠道號
var param = getValue("channel");
var utm_medium = getValue("utm_medium");
var utm_campaign = getValue("utm_campaign");
var utm_term = getValue("utm_term");
var packno = getValue("packno");
var latest_version = getValue("version") || '223'; 


window.onload = function(){
//頁面統計
addStat({da_src:'MwaimaiMiddlePg',da_act:'show',da_trd:'waimai',third_party:utm_medium+utm_campaign+utm_term});
//瀏覽器中
if(!isWeixinBrowser()){
document.body.style.background = "#fff";
document.getElementById("text").style.display = "none";
var device = checkDevice();
if(device == 'ios') {
setTimeout(function(){
window.location.href = "https://itunes.apple.com/cn/app/bai-du-wai-mai/id911686788?l=en&mt=8";
}, 1500);
} else {
setTimeout(function(){
if (param === 'bs') {//如果channel等於bs
window.location.href = "http://域名/PhoneApp.apk";
} else if(packno != ''){//如果指定了packno
window.location.href = "http://域名/PhoneApp.apk";
} else {//預設情況
window.location.href = "http://域名/PhoneApp.apk";
}
},1500);
}
}
}

</script>
</body>
</html>