Name

HashChangeEvent — event object for hashchange events

Inherits from

Event

Synopsis

Browsers fire a hashchange event when the fragment identifier (the portion of a URL beginning with the hash mark #) of the document URL changes. This can happen because of a scripted change to the hash property of the Location object, or because the user used the browser’s Back or Forward buttons to navigate through the browser’s history. In either case, a hashchange event is triggered. The associated event object is a HashChangeEvent. See History Management for more on history management with location.hash and the hashchange event.

Properties

readonly string newURL

This property holds the new value of location.href. Note that this is the complete URL, not just the hash portion of it.

readonly string oldURL

This property holds the old value of location.href.

Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.