THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML DOM documentURI Property

Document Object Reference Document Object

Example

Get the location URI of the document:

var x = document.documentURI;

The result of x will be:

http://www.w3schools.com/jsref/prop_document_documenturi.asp
Try it yourself »

Definition and Usage

The documentURI property sets or returns the location of a document.

If the document was created by the DocumentImplementation object, or if it is undefined, the return value is null.

Tip: Unlike the document.URL property, the documentURI property can be used on any document types, whereas URL can only be used on HTML documents.


Browser Support

Property
documentURI Yes Not supported Yes Yes Yes

Syntax

Return the documentURI property:

document.documentURI

Set the documentURI property:

document.documentURI=locationURI

Technical Details

Return Value: A String, representing the URI of the document
DOM Version Core Level 3 Document Object

Document Object Reference Document Object