js取得当前url,javascript获取当前页面url值,js获取域名

如果获取“当前”域名

host = window.location.host;

url=document.domain;

url = window.location.href;

取得完整url路径: 用以下代码可以完整研证结果:

thisDLoc = document.location;

thisURL = document.URL;

thisHREF = document.location.href;

thisSLoc = self.location.href;

thisTLoc = top.location.href;

thisPLoc = parent.document.location;

thisTHost = top.location.hostname;

thisHost = location.hostname;

运行如下: thisDLoc = document.location;

thisURL = document.URL;

thisHREF = document.location.href;

thisSLoc = self.location.href;

thisTLoc = top.location.href;

thisPLoc = parent.document.location;

thisTHost = top.location.hostname;

thisHost = location.hostname;

thisURL:[http://925bb.taobao.com/js/js%E8%8E%B7%E5%8F%96url.html]

thisHREF:[http://925bb.taobao.com/js/js%E8%8E%B7%E5%8F%96url.html]

thisSLoc:[http://925bb.taobao.com/js/js%E8%8E%B7%E5%8F%96url.html]

thisDLoc:[http://925bb.taobao.com/js/js%E8%8E%B7%E5%8F%96url.html]

thisTLoc:[http://925bb.taobao.com/js/js%E8%8E%B7%E5%8F%96url.html]

thisPLoc:[http://925bb.taobao.com/js/js%E8%8E%B7%E5%8F%96url.html]

thisTHost:[925bb.taobao.com]

thisHost:[925bb.taobao.com]

thisHPage:[js%E8%8E%B7%E5%8F%96url.html]

thisUPage:[js%E8%8E%B7%E5%8F%96url.html]

你可能感兴趣的:(js取得当前url,javascript获取当前页面url值,js获取域名)