获取服务器域名

var pathName=window.document.location.pathname;
var curWwwPath=window.document.location.href;
var pos=curWwwPath.indexOf(pathName);
var prefixUrl=curWwwPath.substring(0,pos);
console.log("pathName:"+pathName);
console.log("curWwwPath:"+curWwwPath);
console.log("pos:"+pos);
console.log("prefixUrl:"+prefixUrl);

你可能感兴趣的:(获取服务器域名)