Page title is not changed by history.pushState

avasin picture avasin · Dec 19, 2012 · Viewed 24k times · Source

I've just opened a blank HTML page with some little amount of base tags (like html, body, head, etc) in Google Chrome, and tried to execute the following command in console:

history.pushState(null, 'my test title', '/test/url');

History events work fine, but the page title stays unchanged. Is it OK? Should I change it manually every time? If I should, why there is such parameter in pushState() method like title?

Answer

Kirill picture Kirill · Mar 7, 2013

It seems current browsers don't support pushState title attribute. You can easily achieve the same thing by setting it in JS.

document.title = "This is the new page title.";