Document.documentURI

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

Syntax

const uri = document.documentURI

Example

JavaScript

document.getElementById("url").textContent = document.documentURI;

HTML

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

Result

Specifications

Specification Status Comment
DOM
The definition of 'documentURI' in that specification.
Living Standard

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
documentURIChrome Full support 1Edge Full support 17Firefox Full support 1IE No support NoOpera Full support ≤12.1Safari Full support 3WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support ≤12.1Safari iOS Full support 1Samsung Internet Android Full support 1.0
Read-only behaviorChrome Full support 43Edge Full support ≤79Firefox Full support YesIE No support NoOpera Full support 30Safari No support NoWebView Android Full support 43Chrome Android Full support 43Firefox Android Full support YesOpera Android Full support 30Safari iOS No support NoSamsung Internet Android Full support 4.0

Legend

Full support  
Full support
No support  
No support

See also