JS gets the current url host address project root path
//Gets the current url, such as HTTP: __localhost: 8080 / Tmall/index. The JSPvar curWwwPath=window.document.location.href;//Get the host address after the directory such as: /Tmall/index.jspvar pathName=window.document.location.pathname;var pos=curWwwPath.indexOf(pathName);//Gets the host address, such as: HTTP: arbitration localhost:8080var localhostPaht=curWwwPath.substring(0,pos);//Get the project name with "/", such as: /Tmallvar projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);