Skip to content

Wrong browser history title when used with history.nette.ajax.js #151

Open

Description

@zipper

Not sure which repository should I use for this issue, since it's dependent on using both. When used in combination with https://github.com/vojtech-dobes/history.nette.ajax.js, there is a bug in browser history titles in Google Chrome (oddly, FireFox handles it right).

When you use <title> tag as a snippet, document.title is changed prior to pushState call. That results in wrong title in Google Chrome history (long press on back button). Lets assume these steps:

  1. Being on page with "Title 1".
  2. Trigger AJAX call which invalidates title snippet, returning "Title 2" as its new content.
  3. Extension snippets updates the title, so it's now "Title 2".
  4. pushState from history.nette.ajax.js is called. First state in history is now titled "Title 2" (as it was last document.title of the page), the new one has the same title (as it is the current document.title).

I'm not sure how to approach this issue, since snippets has to updated before pushState call (because of UI cache) but title has to be unchanged until the pushState call. Moreover, when traversing back in history, the title stays unchanged if UI cache is turned off (I guess this might be treated as separate issue, but it may also be solved with this issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions