web api instance property
Document: URL property
The URL read-only property of the Document
interface returns the document location as a string.
Value
A string containing the URL of the document.
Examples
JavaScript
document.getElementById("url").textContent = document.URL;
HTML
<p id="urlText">
URL:<br />
<span id="url">URL goes here</span>
</p>
Result
Interactive exampleOpen the canonical MDN source to run this embedded demo.
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
- The
documentURIproperty which returns the same value.