Read Document vs Location. Both expose the current address as text.
Equality check. Usually true while viewing a normal page.
Navigation difference. Assigning location.href loads a new page.
Rule of thumb. Read with documentURI/URL; navigate with location.
Compatibility
Browser Support
Document.documentURI is Baseline Widely available (MDN: since April 2018). Returns the document location as a string.
✓ Baseline · Widely available
Document.documentURI
Read-only location string — same family as document.URL on typical pages.
98%Widely available
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
documentURIExcellent
Bottom line: Safe for production reads. Prefer location APIs when you need navigation or URL parts (pathname, search, hash).
Frequently Asked Questions
A string with the document’s location (its URL / URI). On a normal web page it is the address of that page.
No. MDN marks Document.documentURI as Baseline Widely available (since April 2018). It is not Deprecated, Experimental, or Non-standard.
They return the same location string. Prefer either; many codebases use document.URL or location.href for everyday work.
location.href is on the Location object and is commonly used for reading and navigating. documentURI is a Document property that reports the document location as a string (read-only on Document).
No. It is read-only on Document. To navigate, use location.assign / location.href (or the History API).
Yes — like a full page URL string, it typically includes path, query, and fragment when present (same family of values as document.URL / location.href).