js判断地区和设备使url跳转

使用搜狐的判断ip来历的js文件
<script type=”text/javascript” src=”http://pv.sohu.com/cityjson?ie=utf-8“></script>

然后是js内容

if (returnCitySN.cname.indexOf(‘北京’)!=-1){
location.href=”http:// blog.aiwebcom.com”;
}
else{
var check_page = ‘http:// blog.aiwebcom.com’;
var go_url = ‘git.html’;
var system = {
win: false,
mac: false,
xll: false
};
var phone = {
qq: false,
uc: false
};
var p = navigator.platform;
var u = navigator.userAgent;
system.win = p.indexOf(“Win”) == 0;
system.mac = p.indexOf(“Mac”) == 0;
system.xll = p.indexOf(“X11”) == 0;
phone.qq = u.indexOf(“MQQBrowser”) > -1;
phone.uc = u.indexOf(“UC”) > -1;
if (system.win || system.mac || system.xll) {
window.location.replace(check_page);
} else {
window.location.replace(go_url);
}

}