HTML onhashchange Attribute

❮ HTML Attributes

Example

<body onhashchange="myFunction()">

Meaning

The onhashchange attribute fires when the URL’s hash identifier value changes.

Changing this value is commonly performed in Ajax applications to indicate a state change and support browser back-button activity.




Standard Syntax

<element onhashchange="script">



Browser Support




Status




Applies to:

The onhashchange attribute can be used on the following element:

Element Attribute
<body> onhashchange






Attribute Values

Value Description
script Specifies the script to be run on onhashchange
❮ HTML Attributes