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?
Setting the title using
document.title
is not recommended if you want good SEO.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.
Demo
Source
It seems current browsers don't support pushState title attribute. You can easily achieve the same thing by setting it in JS.
Currently, the title is being changed in all modern browsers using history.push(), but you have to change the URL. If you only add "#locationhash" it won't change the title, which makes sense.
Following code will change the page title when you use history.pushState
It is working with IE also.