Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 578 Bytes

File metadata and controls

33 lines (23 loc) · 578 Bytes
title short-title slug page-type browser-compat
HashChangeEvent: newURL property
newURL
Web/API/HashChangeEvent/newURL
web-api-instance-property
api.HashChangeEvent.newURL

{{APIRef("HTML DOM")}}

The newURL read-only property of the {{domxref("HashChangeEvent")}} interface returns the new URL to which the window is navigating.

Value

A string.

Examples

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}