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

以下为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 ];


下面为使用JS获取MAC地址、IP地址及主机名的方法:
复制代码 代码如下:






                                                        



MAC地址:

IP地址:

主机名:




你可能感兴趣的:(JS获取几种URL地址的方法小结)