A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/en-US/docs/Web/API/HashChangeEvent below:

HashChangeEvent - Web APIs | MDN

HashChangeEvent

Baseline Widely available

The HashChangeEvent interface represents events that fire when the fragment identifier of the URL has changed.

The fragment identifier is the part of the URL that follows (and includes) the # symbol.

Event HashChangeEvent Constructor
HashChangeEvent()

Creates a new HashChangeEvent object.

Instance properties

This interface also inherits the properties of its parent, Event.

HashChangeEvent.newURL Read only

The new URL to which the window is navigating.

HashChangeEvent.oldURL Read only

The previous URL from which the window was navigated.

Instance methods

This interface has no methods of its own, but inherits the methods of its parent, Event.

Examples Basic example
function locationHashChanged() {
  if (location.hash === "#some-cool-feature") {
    someCoolFeature();
  }
}

window.addEventListener("hashchange", locationHashChanged);
Specifications Browser compatibility

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.3