window.onpopstate inappropriately called on back button

Issue #14613504 • Assigned to Scott L.

Details

Created
Nov 10, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
41.16299
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

The browser back button will inappropriately fire onpopstate on a page that did not do the pushstate.

Given a set of 3 files/pages, 2 (a.html, b.html) of which constitute a Single Page App (SPA) and a 3rd which does not (c.html).

  • a.html
    • Has a link to b.html using HTML5 history API pushstate
  • b.html
    • Has a link to c.html using a traditional link
    • Navigating to b.html directly results in a 302 redirect to c.html
  • c.html
    • Just a static page

When navigating from a.html to b.html via pushstate, a normal back/forward will work between the two and will fire the appropriate onpopstate event. When then navigating to c.html from b.html via the browser back button, Edge appropriately tries to retrieve b.html and follows the redirect to c.html and believes it is one step back in the history (i.e. you can move forward to c.html again or try to go back to a.html). However, when trying to us browser navigation again to go back to a.html, Edge will fire an onpopstate event in c.html, which did not originate the pushstate and thus has no idea how to handle that event. The browser URL is changed to a.html but it does not attempt to retrieve a.html.

Every other major browser’s (Chrome, FF, Safari) latest versions all understand that the redirect to c.html on the first back navigation means that going back again requires a full reload of a.html and operates as expected by the user.

I’ve distilled the problem down to a small reproducible set of files so the problem looks especially contrived, but it’s happening on a real site. In that case b.html is part of a flow where it’s no longer valid after navigating off of the page, but you can still get back to a.html.

I’ve attached the files for you to host (so that you can institute a redirect if b.html is ever retrieved directly) but I’ve also put them on an s3 website at http://mcameron-test2.s3-website-us-east-1.amazonaws.com/a.html.

Attachments

3 attachments

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “James M.”

    Changed Assigned To to “Scott L.”

You need to sign in to your Microsoft account to add a comment.

Sign in