HashChangeEvent oldURL property

Definition and usage

The oldURL property returns the document's URL before the hash (anchor part) is changed.

This is the URL we navigated away from. To get the URL we navigated to, please use newURL Properties.

This property is read-only.

Tip:To set or return the URL's hash, use location.hash Properties.

Example

After changing the hash, get the URL we navigated away from:

event.oldURL;

The result is:

https://www.codew3c.com/tiy/t.html?f=jsref_onhashchange

Try it yourself

Syntax

event.oldURL

Technical details

Return value: The string value represents the URL from which navigation occurs.

Browser Support

The numbers in the table indicate the first browser version that fully supports the property.

Properties Chrome IE Firefox Safari Opera
oldURL 5.0 Not Supported 6.0 5.0 10.6