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.

Suporte do navegador

Os números na tabela indicam a primeira versão do navegador que suporta completamente o atributo.

Atributos Chrome IE Firefox Safari Opera
oldURL 5.0 Não suportado 6.0 5.0 10.6