Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
HTML and CSS
Events
 onhashchange Event
onhashchange Event
New for Windows Internet Explorer 8
Note: This documentation is preliminary and is subject to change.

Raised upon changes to a fragment—the portion of a URL that follows the number sign (#).

Syntax

Inline HTML<ELEMENT onhashchange = "handler" ... > All platforms
Event propertyobject.onhashchange = handlerJScript only
object.onhashchange = GetRef("handler")Visual Basic Scripting Edition (VBScript) 5.0 or later only
Named script <SCRIPT FOR = object EVENT = onhashchange> Internet Explorer only

Event Information

BubblesYes
CancelsYes
To invoke
  • Set the location.hash (bookmark) property.
  • Navigate to the same page with a different bookmark.
Default action N/A

Event Object Properties

Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query the event object for the following event properties.

Available Properties

cancelBubble Sets or retrieves whether the current event should bubble up the hierarchy of event handlers.
type Sets or retrieves the event name from the event object.

Remarks

In Asynchronous JavaScript and XML (AJAX) applications, client requests that do not trigger traditional page navigation should update the hash property. This lets the Back button function more predictably. The URL fragment (bookmark) can be set by script. The value is appended to the displayed URL, and the navigation is saved in the browser history.

Standards Information

There is no public standard that applies to this event.

Applies To

window, BODY, FRAMESET
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker