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, use newURL Property.

This property is read-only.

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

Example

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

event.oldURL;

Result is:

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

Try it yourself

Syntax

event.oldURL

Technical details

Return value: String value that represents the URL from which navigation occurs.

Browser Support

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

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