history.replaceState() example?

Indeed this is a bug, although intentional for 2 years now.
The problem lies with some unclear specs and the complexity when document.title and back/forward are involved.

See bug reference on Webkit and Mozilla.
Also Opera on the introduction of History API said it wasn’t using the title parameter and probably still doesn’t.

Currently the 2nd argument of pushState and replaceState — the title
of the history entry — isn’t used in Opera’s implementation, but may
be one day.

Potential solution

The only way I see is to alter the title element and use pushState instead:

document.getElementsByTagName('title')[0].innerHTML = 'bar';
window.history.pushState( {} , 'bar', '/bar' );

Leave a Comment