:tools: Scheduled maintenance

Heads up! Downtime for the Forums, related to the NodeBB upgrade, is planned for Thursday, December 14, starting from 10:00 UTC.
Please make sure to finish all your posts before this time. The downtime should only last for a few minutes.

History and document.title

  • 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;    }    }
  • 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! ;^)

Log in to reply
 

Looks like your connection to Opera forums was lost, please wait while we try to reconnect.