``` --- ## Definition and Usage The onhashchange event"> ``` --- ## Definition and Usage The onhashchange event" />
Easy Tutorial
❮ Prop Style Outlineoffset Prop Email Form ❯

onhashchange Event

Event Object

Example

Execute JavaScript when the anchor part changes:

<body onhashchange="myFunction()">

Definition and Usage

The onhashchange event is triggered when the anchor part of the current URL (starting with '#') changes.

Example of an anchor part: Specify the current URL as

You can invoke the event using the following methods:


Browser Support

The numbers in the table indicate the first browser version that supports the event.

Event
onhashchange 5.0 8.0 3.6 5.0 10.6

Syntax

In HTML:

In JavaScript:

In JavaScript, using the addEventListener() method:

Note: Internet Explorer 8 and earlier versions do not support the addEventListener() method.


Technical Details

Bubbles: Yes
Cancelable: No
--- ---
Event Type: Event
--- ---
Supported HTML Tags: <body>
--- ---

Event Object

❮ Prop Style Outlineoffset Prop Email Form ❯