HashChangeEvent oldURL Property
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 »
Description
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.
Syntax
event.oldURL
Technical Details
Return Value: | A String, representing the URL that was navigated from |
---|
Browser Support
event.oldURL
is a DOM Level 4 (2015) feature.
It is supported in all modern browsers:
Chrome | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes |
event.oldURL
is not supported in Internet Explorer 11 (or earlier).