This module provides Benjamin Lupton's History.js as a library to Drupal 7 via the Libraries API. It provides a configuration page to manage which compatibility mode and implementation of History.js to use.

What is History.js?
From the project's creator:

History.js gracefully supports the HTML5 History/State APIs (pushState, replaceState, onPopState) in all browsers. Including continued support for data, titles, replaceState. Supports jQuery, MooTools and Prototype. For HTML5 browsers this means that you can modify the URL directly, without needing to use hashes anymore. For HTML4 browsers it will revert back to using the old onhashchange functionality.

Supported History.js compatibility modes:

  • HTML 5
  • HTML 4+5

Supported Implementations:

  • History.js native
  • History.js for jQuery

Dependencies: Libraries API

How to use History.js with Drupal:
The StateHandler Module provides Drupal with an easy to use plugin interface to History.js. Copy and customize the included example sub-module to tell your application how to handle and build popState data, and the stateHandler handles the rest. The goal for the StateHandler project is to provide an easy way to build a full featured and customized ajax site using Drupal and History.js.

The History.js module provides history.js as a library to Drupal, and nothing more. To use the library with your own site, you'll need to use an existing contributed module such as the the StateHandler Module, or to roll your own module that defines how your application should react to popstates.

The following implementations require development of additional libraries modules:
History.js supports several additional js libraries, however at the time of releasing this module, there are no libraries modules available to include them:

If you would like to see support for one of the implementations above, please contribute a libraries module to implement the framework, and notify me. I'll gladly include your module as a dependency for the specific implementation upon its approval.

Project information