html 获取项目根路径
html 获取项目根路径
function getContextPath(){
var pathName = document.location.pathname; //当前文件的绝度路径
var index = pathName.substr(1).indexOf("/");
var result = pathName.substr(0,index+1);
return result;
}
原文出处:
[1] kopess, html 获取项目根路径, https://blog.csdn.net/yeyingss/article/details/53638679