# Yahoo! UI Library

### history 3.1.1

Yahoo! UI Library > history > History
Search:
Filters Show Private Show Protected Show Deprecated

## Class History

This class represents an instance of the browser history utility.

### Constructor

History `( )`

### Methods

#### _checkIframeLoaded

`private void _checkIframeLoaded ( )`
Periodically checks whether our internal IFrame is ready to be used

#### _getHash

`private string _getHash ( )`
Returns the portion of the hash after the '#' symbol.

Returns: `string`
  The hash portion of the document's location

#### _handleFQStateChange

`private void _handleFQStateChange ( fqstate )`
Sets the new currentState attribute of all modules depending on the new fully qualified state. Also notifies the modules which current state has changed.

Parameters:
  `fqstate <string>` fully qualified state

#### _initialize

`private void _initialize ( )`
Finish up the initialization of the browser utility library.

#### _storeStates

`private void _storeStates ( )`
Stores the initial state and current state for all registered modules in the (hidden) form field specified during initialization.

#### _updateIFrame

`private boolean _updateIFrame ( )`
Update the IFrame with our new state.

Returns: `boolean`
  true if successful. false otherwise.

#### getBookmarkedState

`string getBookmarkedState ( moduleId )`
Returns the state of a module according to the URL fragment identifier. This method is useful to initialize your modules if your application was bookmarked from a particular state.

Parameters:
  `moduleId <string>` Non-empty string representing your module.

Returns: `string`
  The bookmarked state of the specified module.

#### getCurrentState

`string getCurrentState ( moduleId )`
Returns the current state of the specified module.

Parameters:
  `moduleId <string>` Non-empty string representing your module.

Returns: `string`
  The current state of the specified module.

#### getQueryStringParameter

`string getQueryStringParameter ( paramName , queryString )`
Returns the value of the specified query string parameter. This method is not used internally by the Browser History Manager. However, it is provided here as a helper since many applications using the Browser History Manager will want to read the value of url parameters to initialize themselves.

Parameters:
  `paramName <string>` Name of the parameter we want to look up.
  `queryString <string>` Optional URL to look at. If not specified, this method uses the URL in the address bar.

Returns: `string`
  The value of the specified parameter, or null.

Deprecated Use Y.QueryString.parse() in the querystring module. This will be removed in 3.2.0.

#### initialize

`void initialize ( stateField , historyIFrame )`
Initializes the Browser History Manager. Call this method from a script block located right after the opening body tag.

Parameters:
  `stateField <string|HTML Element>` used to store application states. Must be in the static markup.
  `historyIFrame <string|HTML Element>` IFrame used to store the history (only required for IE6/7)

#### multiNavigate

`boolean multiNavigate ( states )`
Stores a new entry in the browser history by changing the state of several registered modules in one atomic operation.

Parameters:
  `states <object>` Associative array of module-state pairs to set simultaneously.

Returns: `boolean`
  Indicates whether the new state was successfully added to the history.

#### navigate

`boolean navigate ( module , state )`
Stores a new entry in the browser history by changing the state of a registered module.

Parameters:
  `module <string>` Non-empty string representing your module.
  `state <string>` String representing the new state of the specified module.

Returns: `boolean`
  Indicates whether the new state was successfully added to the history.

#### register

`History.Module register ( moduleId , initialState )`
Registers a new module.

Parameters:
  `moduleId <string>` Non-empty string uniquely identifying the module you wish to register.
  `initialState <string>` The initial state of the specified module corresponding to its earliest history entry.

Returns: `History.Module`
  The newly registered module

### Events

#### history:globalStateChange

`history:globalStateChange ( )`
Fires when the global state of the page has changed (that is, when the state of at least one browser history module has changed)

#### history:moduleStateChange

`history:moduleStateChange ( )`
Fires when the state of a history module object has changed

#### history:ready

`history:ready ( )`
Fires when the browser history utility is ready

Copyright © 2010 Yahoo! Inc. All rights reserved.