js获取本机ip地址

2019PHP高薪工程师学习路线图....>>>

    /** 
     * 获取本地IP地址 
     */  
    function getLocalIPAddress()  
    {  
        var obj = null;  
        var rslt = "127.0.0.1";  
        try  
        {  
            obj = new ActiveXObject("rcbdyctl.Setting");  
            if (!isNull(obj.GetIPAddress))  
            {  
                rslt = obj.GetIPAddress;              
            }  
            obj = null;  
        }  
        catch(e)  
        {  
            //异常发生  
        }  
          
        return rslt;  
    }