W3cubDocs

/DOM

document.URL

The URL read-only property of the Document interface returns the document location as a string.

Syntax

var string = document.URL 

Example

JavaScript

document.getElementById("urlText").innerHTML = "URL: " + document.URL;

HTML

<p id="urlText">URL goes here.</p>

Result

Specification

© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/document/URL