Skip to content

History and navigation, excluding the navigation API #199

@domenic

Description

@domenic

Description

This focus area is about session history and navigation between URLs. This would include:

  • Foundational interoperability work on things like: what happens when navigating (especially in edge cases); how iframes impact the session history; when load/hashchange/popstate/etc. events fire; the sync vs. async nature of history traversals; what happens if code tries to go back and then forward and then navigate; how well about:/data:/blob: URLs work for navigation; scroll restoration; fragment navigation; etc.

  • The existing navigation and history APIs, i.e. window.location and window.history.

This does not include the new navigation API, which I was advised in #170 should be separated.

Rationale

These areas are historically a large pain for web developers. @tbondwilkinson wrote up a vivid example; you can also see the HTML Standard's list of issues tagged "interop" and either "topic: navigation" or "topic: session history". This pain often spills over into broken behavior for users, e.g. pages not loading, the back button not working, scrolling being broken, or even jQuery's file upload code failing due to interaction with javascript: URL iframes. I suspect implementers who have worked in this area, and been on the frontlines of relevant bug triage, know how thorny an area this is (cc @annevk, @hsivonen, @smaug----, @natechapin). Getting interop on the foundations and existing APIs will lay the ground for the new navigation API to solve a lot of this developer pain.

For some signals, we have use counters such as ~30% of pages using history.replaceState(), ~20% of pages using sandboxed iframes, or of course the fact that 100% of page loads happen via navigation :).

Now is a good time to work on this project. On the specification side, within the month of October we plan to land whatwg/html#6315, which will resolve ~45 known spec issues with a definitive, principled behavior based on a coherent model. As part of that, and in the month or so after landing, we'll be increasing the test coverage for navigation and history, ensuring that all existing tests match the updated spec.

Specification

The following sections of the HTML Standard:

Tests

Note that as part of the spec work mentioned above, over the rest of 2022 we plan to (a) add more coverage to html/browsers/; (b) aspirationally, do a general reorganization and renaming of existing tests of the html/browsers/ directory, since they are some of the oldest tests and thus often their paths don't make any sense or they have useless filenames like 006.html or traverse_the_history_5.html. This should help ensure we're starting from a good baseline, e.g. by fixing any failing-in-all-browsers tests before 2023 starts.

Important note: wpt.fyi is especially fragile for these sorts of tests, often giving incorrect failures. (I.e., failures that don't match what a user sees by loading the corresponding test in the browser on wpt.live.) See, e.g., web-platform-tests/wpt#33590 and web-platform-tests/wpt#23364 . Fixing this would probably need to be a priority for the wpt.fyi infrastructure team, to make this project feasible.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions