js 获取服务器ip

参考:https://blog.csdn.net/u012664198/article/details/82700024

      var urlPath = window.document.location.href;  //浏览器显示地址 http://10.15.5.83:5555/ISV/demo.aspx?a=1&b=2
        var docPath = window.document.location.pathname; //文件在服务器相对地址 /ISV/demo.aspx
        var index = urlPath.indexOf(docPath);
        var serverPath = urlPath.substring(0, index);
posted @ 2019-11-22 14:08  刘阿泽  阅读(5067)  评论(0编辑  收藏  举报