THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML DOM URL Property

❮ Document Object

Example

Get the full URL of the current HTML document:

var x = document.URL;
Try it Yourself »

Definition and Usage

The URL property returns the full URL of the current HTML document.

Note: This property is similar to the location.href property.


Browser Support

Property
URL Yes Yes Yes Yes Yes

Syntax

document.URL

Technical Details

Return Value: A String, representing the entire URL of the document, including the protocol (like http://)
DOM Version Core Level 1 Document Object

❮ Document Object