JavaScript获取contextPath

2021-02-06 05:19

阅读:343

标签:ati   host   fun   script   pat   otp   rip   substr   index   

    function getRootPath() {
        var pathName = window.location.pathname.substring(1);
        var webName = pathName == ‘‘ ? ‘‘ : pathName.substring(0, pathName.indexOf(‘/‘));
        return window.location.protocol + ‘//‘ + window.location.host + ‘/‘ + webName + ‘/‘;
    }

JavaScript获取contextPath

标签:ati   host   fun   script   pat   otp   rip   substr   index   

原文地址:https://www.cnblogs.com/Haidnor/p/12784259.html


评论


亲,登录后才可以留言!