利用API判断地区跳转,指定省份JS跳转代码
( 更新:10-18 加入收藏)
判断地区跳转代码,可以识别当前用户省份,市地区,然后跳转到指定的url上
如:北京用户跳转到bj.html ,上海用户自动跳转到sh.html
如:北京用户跳转到bj.html ,上海用户自动跳转到sh.html
<script src="https://pv.sohu.com/cityjson?ie=utf-8" charset="GB2312" ></script>
<script type=text/javascript>
var _area=remote_ip_info.province;
if( _area=='北京'){
window.location.href="/bj.html";
}else if( _area=='上海'){
window.location.href="/sh.html";
}else{
window.location.href="http://www.xxxx.com/";
}
</script>
下一篇:让手机和电脑显示不同的广告