function getRootPath(){ var curPageUrl = window.document.location.href; var rootPath = curPageUrl.split("//")[0] + curPageUrl.split("//")[1].split("/")[0] + "/" + curPageUrl.split("//")[1].split("/")[1]; return rootPath; }
转载于:https://www.cnblogs.com/lideqiang0909/p/11138094.html