| | |
| | | */ |
| | | function getRootPath() { |
| | | var curWwwPath = window.document.location.href; |
| | | console.log(curWwwPath); |
| | | let url=""; |
| | | var pathName = window.document.location.pathname; |
| | | var url=curWwwPath.substring(0, curWwwPath.indexOf(pathName)); |
| | | if(pathName&&pathName!="/"){ |
| | | url= curWwwPath.substring(0, curWwwPath.indexOf(pathName)); |
| | | }else{ |
| | | url= curWwwPath; |
| | | } |
| | | console.log(url); |
| | | return url; |
| | | |
| | | // if(url.indexOf('localhost')>0){ |
| | | // return url++- pathName.substring(0, pathName.substr(1).indexOf('/') + 1); |
| | | // console.log("1"+url); |
| | |
| | | // return url+ pathName.substring(0, pathName.substr(1).indexOf('/') + 1); |
| | | // console.log("2"+url); |
| | | // } |
| | | return url; |
| | | |
| | | } |
| | | /** 全局路径,代表当前网站的根URL */ |
| | | var basePath = getRootPath(); |