We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

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("url").textContent = document.URL;

HTML

<p id="urlText">
  URL:<br/>
  <span id="url">URL goes here</span>
</p>

Result

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'Document.URL' in that specification.
Living Standard Defined that the property is a USVString instead of a DOMString.
Document Object Model (DOM) Level 1 Specification
The definition of 'Document.URL' in that specification.
Obsolete Initial definition

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes Yes Yes Yes Yes Yes
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes Yes Yes Yes Yes Yes ?

See also

Document Tags and Contributors

Last updated by: fscholz,