Current URL JavaScript

[Total: 0    Average: 0/5]

How to get a URL link to the page itself on the page.

Body Code:

The following script generates the current url of the page, without the hyperlink.

 <SCRIPT LANGUAGE="JavaScript">
    
            <!--
            {
              document.write(location.href);
            }
            // -->
 </SCRIPT>
<pre>
 It displays the current url like this:

  
 

 The following script generates the current url of the page, with the
 hyperlink.

                (Credit to Tejaswi Kasturi for this one.) 
</pre>
 <SCRIPT LANGUAGE="JavaScript">
    
            <!--
            document.write('<A HREF="' + location.href +'">');
            document.write(location.href);
            document.write('</A>');
            // -->
 </SCRIPT>

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *