HashChangeEvent newURL Property

Example

When the hash has been changed, get the URL we are navigating to:

event.newURL;
Try it Yourself »

Description

The newURL property returns the URL of the document, after the hash (anchor part) has been changed.

This is the URL that was navigated to. To get the URL that was navigated away from, use the oldURL property.

This property is read-only.

Tip: To set or return the hash of a URL, use the location.hash property.


Syntax

event.newURL

Technical Details

Return Value: A String, representing the URL that was navigated to

Browser Support

event.newURL is a DOM Level 4 (2015) feature.

It is supported in all modern browsers:

Chrome Edge Firefox Safari Opera
Yes Yes Yes Yes Yes

event.newURL is not supported in Internet Explorer 11 (or earlier).



Copyright 1999-2023 by Refsnes Data. All Rights Reserved.