笔记:js实现获得访问用户的ip地址。新浪接口

先引用新浪的js文件,然后直接读取数据即可。

<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<script type="text/javascript">
document.write(returnCitySN["cip"]+','+returnCitySN["cname"]);  
</script>

QQ图片20181012144557.png

测试地址

发表新评论
2016tx.gificon_cool.gif2016qd.gificon_arrow.gificon_rolleyes.gif2016gg.gificon_redface.gificon_wink.gif2016zk.gif2016jk.gificon_idea.gificon_biggrin.gif2016zhh.gif2016shuai.gif2016am.gificon_neutral.gificon_razz.gificon_exclaim.gif2016yun.gif2016kel.gificon_sad.gif2016fendou.gif2016ll.gif