HashChangeEvent oldURL Property
THE WORLD'S LARGEST WEB DEVELOPER SITE

HashChangeEvent oldURL Property

❮ DOM Events ❮ HashChangeEvent

Example

When the hash has been changed, get the URL we navigated away from:

event.oldURL;

The result could be:

https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onhashchange
Try it Yourself »

Definition and Usage

The oldURL property returns the URL of the document, before the hash (anchor part) was changed.

This is the URL that was navigated away from. To get the URL that was navigated to, use the newURL property.

This property is read-only.

Tip: To set or return the hash of a URL, use the location.hash property.


Browser Support

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

Property
oldURL 5.0 Not supported 6.0 5.0 10.6

Syntax

event.oldURL

Technical Details

Return Value: A String, representing the URL that was navigated from

❮ DOM Events ❮ HashChangeEvent