Name

URL — NN 3 IE 4 DOM n/a

Synopsis

Read/Write

The URL of the current document. The value is the same as location.href. Netscape deprecates the usage of the document.location property in favor of the document.URL property to avoid potential confusion (by scripters and JavaScript interpreter engines) between the location object and document.location property. To navigate to another page, it is safest (for cross-browser and backward compatibility) to assign a URL string value to the location.href property, rather than this document-centered property.

Example

document.URL = "http://www.megacorp.com"

Value

Complete or relative URL as a string.

Default

The current document’s URL.

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.