HTML DOM Document documentURI Attribute

Definition and Usage

documentURI The attribute sets or returns the document's location.

If the document is created in memory, the documentURI attribute returns null.

Note

documentURI The attribute can be used for any document type.

document.URL The attribute can only be used in HTML documents.

See also:

Document URL Attribute

Example

Get the document's location URI:

let uri = document.documentURI;

Try it yourself

Syntax

Return the documentURI attribute:

document.documentURI

Set the documentURI attribute:

document.documentURI = locationURI

Attribute value

Type Description
String The URI of the document.

Browser support

All modern browsers support document.documentURI:

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Supported Supported Supported Supported Supported

Internet Explorer 11 (or earlier versions) does not support document.documentURI.