js 根据地区跳入指定路径

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>

</body>
</html>

<script type="text/javascript" src="http://ip.ws.126.net/ipquery"></script>
<script>
var province=localAddress.province;//获取所在省,比如广东省
var city=localAddress.city;//获取所在市,比如广州市
var host = window.location.host;

if (host == 'www.ee.com') {
if(province == '北京市'){
window.location.href = "http://www.baidu.com";
}else if(province == '上海市'){
window.location.href = "http://www.google.com";
}
}
</script>

posted @ 2021-11-16 09:22  晓帅啦  阅读(99)  评论(0编辑  收藏  举报