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.
A string.
window.addEventListener("hashchange", (event) => {
console.log(`Hash changed to ${event.newURL}`);
});
{{Specifications}}
{{Compat}}