js获取api的一系列API接口

1
2
3
4
5
window.location.host
document.domain(vue下会发生错误)

//全地址
window.location.href

补充: 获取当前域名信息 代码如下

1
2
3
4
5
6
7
8
9
thisTLoc = top.location.href;
thisPLoc = parent.document.location;
thisTHost = top.location.hostname;
thisHost = location.hostname;
strwrite =  thisTLoc: [" + thisTLoc + "]
strwrite +=  thisPLoc: [" + thisPLoc + "]
strwrite +=  thisTHost: [" + thisTHost + "]
strwrite +=  thisHost: [" + thisHost + "]
document.write( strwrite );