CancelImage Upload

How to load a page's current URL with JavaScript

To load the a browser's current location via JavaScript the following code is required. Simply specify the document object, and request the extension URL:

var location = document.URL;

For a more extensive example of how to output the current URL to a HTML document via getElementById() try the following example:

<title>How to load a page's current URL with JavaScript</title>
<script type="text/javascript">
function loadLocation()

        var location = document.getElementById("location");

        location.innerHTML = document.URL;


<body onload="javascript:loadLocation();">

Current URL: <i id="location"></i>

Want to leave a comment?

No problem. Just enter your email and password below.

register | home | reminder

myDesignTool Networking •