• Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Rules
    • Help

    Do more on the web, with a fast and secure browser!

    Download Opera browser with:

    • built-in ad blocker
    • battery saver
    • free VPN
    Download Opera

    History and document.title

    Opera for Windows
    1
    2
    1041
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • WoodrowShigeru
      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;    }    }
      
      Reply Quote 0
        1 Reply Last reply
      • WoodrowShigeru
        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! 😉

        Reply Quote 0
          1 Reply Last reply
        • First post
          Last post

        Computer browsers

        • Opera for Windows
        • Opera for Mac
        • Opera for Linux
        • Opera beta version
        • Opera USB

        Mobile browsers

        • Opera for Android
        • Opera Mini
        • Opera Touch
        • Opera for basic phones

        • Add-ons
        • Opera account
        • Wallpapers
        • Opera Ads

        • Help & support
        • Opera blogs
        • Opera forums
        • Dev.Opera

        • Security
        • Privacy
        • Cookies Policy
        • EULA
        • Terms of Service

        • About Opera
        • Press info
        • Jobs
        • Investors
        • Become a partner
        • Contact us

        Follow Opera

        • Opera - Facebook
        • Opera - Twitter
        • Opera - YouTube
        • Opera - LinkedIn
        • Opera - Instagram

        © Opera Software 1995-