by Howard B. Richman
Place this code one time on your master page or on your footer and it will display as the unique full absolute URL of each individual web page within your site. There are two versions of the JavaScript: one that shows the pure file path and one that creates a hyperlink. See also: tutorials, free tips, free information.
Why Would you Need to Display the Current URL of the Page?
This script is ideal if you want the current URL to show up on each page, but you don’t want to have to manually do it. This might be useful as a courtesy for viewing or printing to indicate its source.
The following script generates the current url of the page, without the hyperlink.
<script>// <![CDATA[
{
document.write(location.href);
}
// ]]></script>
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.)
<script>// <![CDATA[
{
document.write('<A HREF="' + location.href +'">');
document.write(location.href);
document.write('</A>');
}
// ]]></script>
It displays the current url like this: