获取网站的BaseURL

//get base URL
            var _urlstr = window.location.href;
            if (_urlstr.indexOf("?") > -1) {
                _urlstr = _urlstr.substring(0, _urlstr.lastIndexOf("?"));
            }
            _urlstr = _urlstr.substring(0, _urlstr.lastIndexOf("/"));
            _urlstr = _urlstr.substring(0, _urlstr.lastIndexOf("/"));

例如:http://localhost:1781/tool/yakujihou.aspx

_urlstr为:http://localhost:1781

上一篇:对抗密码破解 —— Web 前端慢 Hash


下一篇:学习vim命令:“:w !sudo tee %”