JS 获取IP地址、IP归属地

一、引用

    <script src="https://pv.sohu.com/cityjson?ie=utf-8"></script>
    <script src="https://ip.ws.126.net/ipquery"></script>

二、

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script>
    var iPAddress = "", iPAttach = "";//IP地址,IP归属地
    GetIPAll();
    //获取IP地址,IP归属地
    function GetIPAll() {
        iPAddress = returnCitySN["cip"];//IP地址:
        iPAttach = localAddress["province"] + localAddress["city"];//IP归属地
    }

</script>

 

posted @ 2020-05-19 14:44  雨殇丶  阅读(3439)  评论(0编辑  收藏  举报