根据终端分配不同的url地址

时间:2023-03-10 01:37:39
根据终端分配不同的url地址
<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>手机APP下载页面:根据终端辨别下载地址</title>
<script type="text/javascript">
// 获取终端的相关信息
var Terminal = {
// 辨别移动终端类型
platform : function(){
var u = navigator.userAgent, app = navigator.appVersion;
return {
// android终端或者uc浏览器
android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,
// 是否为iPhone
iPhone: u.indexOf('iPhone') > -1 ,
// 是否iPad
iPad: u.indexOf('iPad') > -1
};
}(),
// 辨别移动终端的语言:zh-cn、en-us、ko-kr、ja-jp...
language : (navigator.browserLanguage || navigator.language).toLowerCase()
} // 根据不同的终端,跳转到不同的地址
var theUrl = '1232';
if(Terminal.platform.android){
theUrl = 'http://xzzh.xiaoyou-game.com/a';
}else if(Terminal.platform.iPhone){
theUrl = 'http://xzzh.xiaoyou-game.com/b';
}
location.href = theUrl;
</script>
</head>
<body>
<!--
有啥问题,请直接到这里来反馈:http://www.baidu.com/
-->
</body>
</html>