Skip to content

[pat-inject] Reloads the page on same document browser history navigation #1293

Description

@cihanandac

Description

Navigating back in the browser history causes the entire page to reload, even when the navigation stays within the same page. If you go to an anchor point within the same page (for example #test) and then go back on history, the whole page reloads instead of just navigating within the same page.

How we encountered this

We (freitag.de) are currently implementing a third-party widget that opens a modal when clicked on. When the modal is closed, it returns back in the browser history which is causing this full page load.

How to reproduce

  1. Open classic.demo.plone.org
  2. Add #test to the end of the URL and press Enter. (No reload yet)
  3. Press the browser's Back button. (alternatively run history.back() on the browser's console)

Expected behavior: URL simply changes back to /en without full page reload.
What is actually happening: The whole page reloads.

Thoughts on why is happens

When the page is loaded initially; the state is marked as pageload, and then it adds a popstate listener which reloads the page when there is a history change. I think the culprit is culprit is inject.js, lines 1165–1186.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions