History and document.title
-
WoodrowShigeru last edited by
I'm trying to programmatically change the document.title after the page was loaded – which does work – but if you open the quick history (click on the arrow in the address bar), the original, old, initial title still shows up where the new title should be. Meanwhile in Chrome, the same code does exactly what I want and show the updated titles, meaning that the code is fine but it's an Opera issue.
Are there any workarounds you can think of?
(I'm using Opera 12.16, btw)
function update_title(){ if ( document && document.title && (document.title.toLowerCase() == "too generic") ) { var better = ""; if ( better = $('h1:first').text() ) document.title = better; } }
-
WoodrowShigeru last edited by
Hey yeah, that link did help. I needed to also call the replaceState() method like this:
history.replaceState( {state:0}, better );
… where {state:0} refers to the data that the doc is talking about, or the current document.
Thanks a lot!