记录js获取当前URL

获得地址栏中完整的地址:

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

href = document.referrer;

显示主机名:

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 ]; 

原文地址:https://www.cnblogs.com/liuting/p/2353802.html