HTML DOM Document documentURI

Example

Get the location URI of the document:

let uri = document.documentURI;
Try it Yourself »

Description

The documentURI property sets or returns a document's location.

The documentURI property returns null if the document was created in memory.

Note

The documentURI property can be used on any document types.

The document.URL property can only be used on HTML documents.

See Also:

The Document URL Property


Syntax

Return the documentURI property:

document.documentURI

Set the documentURI property:

document.documentURI = locationURI

Property Value

Type Description
StringThe URI of the document.

Browser Support

document.documentURI is supported in all modern browsers:

Chrome Edge Firefox Safari Opera
Yes Yes Yes Yes Yes

document.documentURI is not supported in Internet Explorer 11 (or earlier).


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.