URL Property

Internet Development Index

Sets or retrieves the URL for the current document.

Syntax

document.URL [ = sURL ]

Possible Values

sURLString that specifies or receives the URL.

The property is read/write. The property has no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.

Remarks

The URL property is case-sensitive.

This property is an alias for the location.href property on the window.

Example

This example function returns the URL property of the current document.

function getURL()
{
return document.URL;
}

Standards Information

This property is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 Non-Microsoft link.

Applies To

document

See Also

urn, URLUnencoded