Js获取客户端用户Ip地址

利用搜狐查询接口查询Ip地址:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>GetIp</title>
</head>
<body>
    <script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
    <script>
        document.write(returnCitySN["cip"] + ',' + returnCitySN["cname"])
    </script>
</body>
</html>

 

也可以直接通过链接查看返回结果:http://pv.sohu.com/cityjson?ie=utf-8

 

posted @ 2018-09-26 11:45  hymmini  阅读(372)  评论(1编辑  收藏  举报