js ctxpath

js获取当前应用名


document.location.pathname

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

你可能感兴趣的:(JS)