MDN self-hosted library · e01.org

HashChangeEvent: oldURL property

HTML DOM

Open notebook · 1 cells web-api-instance-property upstream source

HTML DOM

The oldURL read-only property of the HashChangeEvent interface returns the previous URL from which the window was navigated.

Value

A string.

Examples

window.addEventListener("hashchange", (event) => {
  console.log(`Hash changed from ${event.oldURL}`);
});

Specifications

Browser compatibility