Raised when there are changes to the portion of a URL that follows the number sign (#).
|HTML Attribute||<element onhashchange = "handler(event)">|
|Event Property||object.onhashchange = handler;|
|attachEvent Method||object.attachEvent("onhashchange", handler)|
|addEventListener Method||object.addEventListener("hashchange", handler, useCapture)|
Event handler parameters
- pEvtObj [in]
There are no standards that apply here.
Windows Internet Explorer 8. The browser's Back and Forward buttons do not generate HTMLWindowEvents3::onhashchange events for frames or iframes; instead, the frame is refreshed each time. Web pages hosted in frames or iframes should use their HTMLFrameSiteEvents::onload handler or equivalent to read the current URL hash information from the location.IHTMLAnchorElement::hash property and set their states accordingly.
When first navigating to a page that contains a hash identifier in the URL, an HTMLWindowEvents3::onhashchange event is not fired. It is expected that the freshly loaded page can inspect the value of the location.IHTMLAnchorElement::hash property to extract the current hash value. After this first page loads, setting the IHTMLAnchorElement::hash property will fire the HTMLWindowEvents3::onhashchange event as expected. This behavior avoids any negative impact on Web page load performance by removing a possible redundant event.
To invoke this event, do one of the following:
- Set the location.IHTMLAnchorElement::hash (bookmark) property.
- Navigate to the same page with a different bookmark.
The pEvtObj parameter is required for the following interfaces: