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 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;
Result is:
https://www.codew3c.com/tiy/t.html?f=jsref_onhashchange
Syntax
event.oldURL
Technical details
Return value: | String value that represents the URL from which navigation occurs. |
---|
浏览器支持
表中的数字注明了完全支持该属性的首个浏览器版本。
属性 | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
oldURL | 5.0 | 不支持 | 6.0 | 5.0 | 10.6 |