search

goog.History

Provided By
Extends
All Implemented Interfaces

A history management object. Can be instantiated in user-visible mode (uses the address fragment to manage state) or in hidden mode. This object should be created from a script in the document body before the document has finished loading.

To store the hidden states in browsers other than IE, a hidden iframe is used. It must point to a valid html page on the same domain (which can and probably should be blank.)

Sample instantiation and usage:

 // Instantiate history to use the address bar for state.
 var h = new goog.History();
 goog.events.listen(h, goog.history.EventType.NAVIGATE, navCallback);
 h.setEnabled(true);

 // Any changes to the location hash will call the following function.
 function navCallback(e) {
   alert('Navigated to state "' + e.token + '"');
 }

 // The history token can also be set from code directly.
 h.setToken('foo');
 

new History( opt_invisible, opt_blankPageUrl, opt_input, opt_iframe )

Parameters
opt_invisibleboolean=

True to use hidden history states instead of the user-visible location hash.

opt_blankPageUrlgoog.html.TrustedResourceUrl=

A URL to a blank page on the same server. Required if opt_invisible is true. This URL is also used as the src for the iframe used to track history state in IE (if not specified the iframe is not given a src attribute). Access is Denied error may occur in IE7 if the window's URL's scheme is https, and this URL is not specified.

opt_input(HTMLInputElement|null)=

The hidden input element to be used to store the history token. If not provided, a hidden input element will be created using document.write.

opt_iframe(HTMLIFrameElement|null)=

The hidden iframe that will be used by IE for pushing history state changes, or by all browsers if opt_invisible is true. If not provided, a hidden iframe element will be created using document.write.

Instance Methods

Instance Properties

Static Functions

Static Properties

Classes

Enumerations