//Get the current URL, such as: http:// localhost:8080/Tmall/index.jsp
var curWwwPath=window.document.location.href;
//The directory after obtaining the host address is: /Tmall/index.jsp
var pathName =window.document.location.pathname;
var pos=curWwwPath.indexOf(pathName);
//Get the host address, such as: http://localhost:8080
var localhostPaht=curWwwPath .substring(0,pos);
//Get the project name with "/", such as: /Tmall
var projectName=pathName.substring(0,pathName.substr(1).indexOf( '/') 1);