当前位置: 移动技术网 > IT编程>开发语言>JavaScript > js实现PC端根据IP定位当前城市地理位置

js实现PC端根据IP定位当前城市地理位置

2019年03月24日  | 移动技术网IT编程  | 我要评论

话不多说,请看代码:

<script type="text/javascript">
 $.getscript('http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js', function(_result) {
 if (remote_ip_info.ret == '1') {
 alert('国家:' + remote_ip_info.country +'\n省:' + remote_ip_info.province + '\n市:' + remote_ip_info.city + '\n区:' + remote_ip_info.district + '\nisp:' + remote_ip_info.isp + '\n类型:' + remote_ip_info.type + '\n其他:' + remote_ip_info.desc);
 } else {
 alert('没有找到匹配的ip地址信息!');
 }
 });
</script>

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持移动技术网!

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网