URL Property (document, HTMLDocument Constructor)

Switch View :
ScriptFree
URL Property

Sets or gets the URL for the current document.

Syntax

[ sURL = ] object.URL

Possible Values

sURL String that specifies or receives the URL.

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

DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are supported in IE7 Standards mode and IE5 (Quirks) mode only. For more information, see About Dynamic Properties and Defining Document Compatibility.

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 Document Object Model (DOM) Level 1.

Applies To

document, HTMLDocument Constructor

See Also

Community Content

Artyom Shegeda
Property is readonly

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

2. This property is defined in Document Object Model (DOM) Level 1.

http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-26809268

URL of type DOMString, readonly
The complete URI of the document.

So, this property cannot be used to change the document location