Title of history.pushState is unsupported, what's a good alternative?

cross-browser, dom, html, html5-history, javascript

Solution

History.js gracefully supports the HTML5 History/State APIs (pushState, replaceState, onPopState) in all browsers.

Take a look at the demos here

Example of use:

History.pushState({state:1}, "State 1", "?state=1"); // logs {state:1}, "State 1", "?state=1"
History.pushState({state:2}, "State 2", "?state=2"); // logs {state:2}, "State 2", "?state=2"
History.replaceState({state:3}, "State 3", "?state=3"); // logs {state:3}, "State 3", "?state=3"
History.pushState(null, null, "?state=4"); // logs {}, '', "?state=4"
History.back(); // logs {state:3}, "State 3", "?state=3"
History.back(); // logs {state:1}, "State 1", "?state=1"
History.back(); // logs {}, "Home Page", "?"
History.go(2); // logs {state:3}, "State 3", "?state=3"

Problem

The second parameter of `History.pushState` and `History.replaceState` can be used to set the "title" of the history entry. This means that when the user clicks through page 1 to page 8, this is what he should see in his history bar: And it is working on Safari and Opera. But on Chrome and FireFox, this is what the user sees: Trying to change `document.title` doesn't work as it changes all the entries within the history title: What's the best solution to this problem? Are we forced to using only one history title for all the pages implemented using `pushState` and `replaceState`?

Original source