JavaScript获取contextPath
2021-02-06 05:19
标签:ati host fun script pat otp rip substr index JavaScript获取contextPath 标签:ati host fun script pat otp rip substr index 原文地址:https://www.cnblogs.com/Haidnor/p/12784259.html 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 + ‘/‘;
}