YouTip LogoYouTip

Event Onhashchange

# onhashchange Event [![Image 3: Event Object Reference Manual](#) Event Object](#) ## Example Execute JavaScript when the hash part changes: [Try it Β»](#) * * * ## Definition and Usage The onhashchange event fires when the hash fragment (starting with the '#' character) of the current URL has changed. Example of a hash fragment: Specify the current URL as http://www.example.com/test.htm#part2 - the hash fragment in this URL is #part2. You can trigger the event in the following ways: * Modify the hash fragment by setting the [location.hash](#) or [location.href](#) property of the (#). * Navigate to the current page using a different bookmark (using the "back" or "forward" button). * Click a link to jump to a bookmark anchor. * * * ## Browser Support The numbers in the table specify the first browser version that fully supports the event. | Event | | | | | | | --- | --- | --- | --- | --- | --- | | onhashchange | 5.0 | 8.0 | 3.6 | 5.0 | 10.6 | * * * ## Syntax In HTML: <_element_ onhashchange="_myScript_")(#) In JavaScript: _object_.onhashchange=function(){_myScript_};(#) In JavaScript, using the addEventListener() method: _object_.addEventListener("hashchange", _myScript_);(#) **Note:** Internet Explorer 8 and earlier versions of IE do not support the [addEventListener()](#) method. * * * ## Technical Details | Bubbles: | Yes | | --- | --- | | Cancelable: | No | | Event Type: | Event | | Supported HTML Tags: | | * * Event Object](#)
← Php ExpectationsPhp Csprng β†’