前端获取当前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);
}