Yahoo! UI Library

history  3.3.0pr1

Yahoo! UI Library > history > HistoryHTML5
Search:
 
Filters

Class HistoryHTML5 - extends HistoryBase

Provides browser history management using the HTML5 history API.

When calling the add(), addValue(), replace(), or replaceValue() methods on HistoryHTML5, the following additional options are supported:

title (String)
Title to use for the new history entry. Browsers will typically display this title to the user in the detailed history window or in a dropdown menu attached to the back/forward buttons. If not specified, the title of the current document will be used.
url (String)
URL to display to the user for the new history entry. This URL will be visible in the browser's address bar and will be the bookmarked URL if the user bookmarks the page. It may be a relative path ("foo/bar"), an absolute path ("/foo/bar"), or a full URL ("http://example.com/foo/bar"). If you specify a full URL, the origin must be the same as the origin of the current page, or an error will occur. If no URL is specified, the current URL will not be changed.

Constructor

HistoryHTML5 ( config )
Parameters:
config <Object> (optional) Configuration object. The following HistoryHTML5-specific properties are supported in addition to those supported by HistoryBase:
enableSessionFallback (Boolean)

Set this to true to store the most recent history state in sessionStorage in order to seamlessly restore the previous state (if any) when HistoryHTML5 is instantiated after a window.onpopstate event has already fired.

By default, this setting is false.

Properties

SRC_POPSTATE - static final String

Constant used to identify state changes originating from popstate events.

Properties inherited from HistoryBase:

Methods

_getSessionKey

protected String _getSessionKey ( )
Returns a string unique to the current URL pathname that's suitable for use as a session storage key.

_loadSessionState

protected void _loadSessionState ( )
Attempts to load a state entry stored in session storage.

_onPopState

protected void _onPopState ( e )
Handler for popstate events.
Parameters:
e <Event>

_storeSessionState

protected void _storeSessionState ( state )
Stores the specified state entry in session storage if the enableSessionFallback config property is true and either Y.JSON or native JSON support is available and session storage is supported.
Parameters:
state <mixed> State to store. May be any type serializable to JSON.

_storeState

protected void _storeState ( src , newState , options )
Overrides HistoryBase's _storeState() and pushes or replaces a history entry using the HTML5 history API when necessary.
Parameters:
src <String> Source of the changes.
newState <Object> New state to store.
options <Object> Zero or more options.


Copyright © 2010 Yahoo! Inc. All rights reserved.