前端获取当前url路径
//获取url路径
function getUrlPath(){//获取当前网址var currentPath = window.document.location.href;//获取主机地址之后的目录var pathName = window.document.location.pathname;var pos = currentPath.indexOf(pathName);//获取主机地址var localhostPath = currentPath.substring(0,pos);//获取带"/"的项目名var projectName = pathName.substring(0,pathName.substr(1).indexOf('/')+1);return (localhostPath+projectName);
}