If you get the "current" domain name host = Window.location.host;
Url=document.domain;
url = window.location.href;
Get full URL path: The following code can be used to fully document the results:
<table width=100% cellpadding=0 cellspacing=0 border=0 > <script> thisurl = document. url; Thishref = document.location.href; Thissloc = self.location.href; ThisDLoc = document.location;& nbsp Strwrite = "<tr><td Valign=top>thisurl: </td><td>[" + Thisurl + "]</td></tr>" Strwrite + + <tr><td valign=top>thishref: </td><td>["+ thishref +"]</td></tr& gt; " Strwrite + + <tr><td Valign=top>thissloc: </td><td>["+ Thissloc +"]</td></tr& gt; " Strwrite + + <tr><td Valign=top>thisdloc: </td><td>["+ Thisdloc +"]</td></tr& gt; " document.write (strwrite); </script> thisdloc = document.location; <BR> Thisurl = document. URL; <BR> thishref = document.location.href; <BR> thissloc = self.location.href;<br> <script> thistloc = top.location.href; Thisploc = parent.document.location; Thisthost = top.location.hostname; Thishost = location.hostname; Strwrite = "<tr><td valign=top>thistloc: </td><td>[" + Thistloc + "]</td></tr>" Strwrite + + <tr><td Valign=top>thisploc: </td><td>["+ Thisploc +"]</td></tr& gt; " Strwrite + + <tr><td valign=top>thisthost: </td><td>["+ thisthost +"]</td></ Tr> " Strwrite + +" <TR><TD valign=top>thishost: </td><td>["+ thishost +"]</td>& Lt;/tr> " document.write (strwrite); </script> thistloc = top.location.href; <BR> thisploc = parent.document.location; <BR> thisthost = top.location.hostname; <BR> thishost = location.hostname;<br> <script> tmphpage = Thishref.split ("/"); Thishpage = tmphpage[tmphpage.length-1]; tmpupage = Thisurl.split ("/"); Thisupage = TMpupage[tmpupage.length-1]; strwrite = "<tr><td valign=top>thishpage: </td><td>[" + Thishpage + "]</td></tr>" strwrite + = "<tr><td valign=top>thisupage: </TD><TD >["+ thisupage +"]</td></tr> " document.write (strwrite); </SCRIPT><TR><TD >
Run as follows:Thisurl:["+ Thisurl +"] "Strwrite + +"Thishref:["+ Thishref +"] "Strwrite + +"Thissloc:["+ Thissloc +"] "Strwrite + +"Thisdloc:["+ Thisdloc +"] "document.write (strwrite); -->thisurl: [http://it.sinoeb.cn/%E7%BD%91%E7%AB%99/Javascript%E6%8A%80%E6%9C%AF/js%E5%8F%96%E5%BE%97%E5% bd%93%e5%89%8durljavascript%e8%8e%b7%e5%8f%96%e5%bd%93%e5%89%8d%e9%a1%b5%e9%9d%a2url%e5%80%bcjs%e8%8e%b7%e5%8f %96%e5%9f%9f%e5%90%8d.html] Thishref: [http://it.sinoeb.cn/%E7%BD%91%E7%AB%99/Javascript%E6%8A%80%E6%9C%AF/js%E5 %8f%96%e5%be%97%e5%bd%93%e5%89%8durljavascript%e8%8e%b7%e5%8f%96%e5%bd%93%e5%89%8d%e9%a1%b5%e9%9d%a2url%e5%80% Bcjs%e8%8e%b7%e5%8f%96%e5%9f%9f%e5%90%8d.html] Thissloc: [http://it.sinoeb.cn/%E7%BD%91%E7%AB%99/Javascript%E6% 8a%80%e6%9c%af/js%e5%8f%96%e5%be%97%e5%bd%93%e5%89%8durljavascript%e8%8e%b7%e5%8f%96%e5%bd%93%e5%89%8d%e9%a1% B5%e9%9d%a2url%e5%80%bcjs%e8%8e%b7%e5%8f%96%e5%9f%9f%e5%90%8d.html] Thisdloc: [http://it.sinoeb.cn/%E7%BD%91%E7% Ab%99/javascript%e6%8a%80%e6%9c%af/js%e5%8f%96%e5%be%97%e5%bd%93%e5%89%8durljavascript%e8%8e%b7%e5%8f%96%e5%bd %93%e5%89%8d%e9%a1%b5%e9%9d%a2url%e5%80%bcjs%e8%8e%b7%e5%8f%96%e5%9f%9f%e5%90%8d.html] Thistloc: [http://it.sinoeb.cn/%E7%BD%91%E7%AB%99/Javascript%E6%8A%80%E6%9C%AF/js%E5%8F%96%E5 %be%97%e5%bd%93%e5%89%8durljavascript%e8%8e%b7%e5%8f%96%e5%bd%93%e5%89%8d%e9%a1%b5%e9%9d%a2url%e5%80%bcjs%e8% 8e%b7%e5%8f%96%e5%9f%9f%e5%90%8d.html] Thisploc: [http://it.sinoeb.cn/%E7%BD%91%E7%AB%99/Javascript%E6%8A%80%E6% 9c%af/js%e5%8f%96%e5%be%97%e5%bd%93%e5%89%8durljavascript%e8%8e%b7%e5%8f%96%e5%bd%93%e5%89%8d%e9%a1%b5%e9%9d% A2url%e5%80%bcjs%e8%8e%b7%e5%8f%96%e5%9f%9f%e5%90%8d.html] Thisthost: [it.sinoeb.cn] Thishost: [it.sinoeb.cn] Thishpage: [Js%e5%8f%96%e5%be%97%e5%bd%93%e5%89%8durljavascript%e8%8e%b7%e5%8f%96%e5%bd%93%e5%89%8d%e9%a1%b5%e9 %9d%a2url%e5%80%bcjs%e8%8e%b7%e5%8f%96%e5%9f%9f%e5%90%8d.html] Thisupage: [js%e5%8f%96%e5%be%97%e5%bd%93%e5%89% 8durljavascript%e8%8e%b7%e5%8f%96%e5%bd%93%e5%89%8d%e9%a1%b5%e9%9d%a2url%e5%80%bcjs%e8%8e%b7%e5%8f%96%e5%9f%9f %e5%90%8d.html]