JS获取几种URL地址的方法小结

来源:互联网 发布:字母logo在线设计软件 编辑:程序博客网 时间:2024/05/18 01:00

以下为JS获取几种URL地址的方法

复制代码 代码如下:

thisURL = document.URL;
thisHREF = document.location.href;
thisSLoc = self.location.href;
thisDLoc = document.location;

thisTLoc = top.location.href;
thisPLoc = parent.document.location;
thisTHost = top.location.hostname;
thisHost = location.hostname;

tmpHPage = thisHREF.split( "/" );
thisHPage = tmpHPage[ tmpHPage.length-1 ];
tmpUPage = thisURL.split( "/" );
thisUPage = tmpUPage[ tmpUPage.length-1 ];

0 0