JS文件中获取contextPath的方法

时间:2022-11-19 19:44:32

function getContextPath() {
    var pathName = document.location.pathname;
    var index = pathName.substr(1).indexOf("/");
    var result = pathName.substr(0,index+1);
    return result;
}

相关文章