← Back to release summary
Navigation API
- Category
- Miscellaneous
- Type
- New or changed feature
- Status
- Enabled by default (Chrome 102)
- Intent stage
- Prepare to ship
Summary
The window.navigation API provides the ability to intercept and initiate navigations, as well as introspect an application's history entries. This provides a more useful alternative to window.history and window.location, specifically aimed at the needs of single-page web applications.
(Note: this API was formerly known as the app history API.)
Motivation
The existing window.history API is hard to deal with in practice, especially for single-page applications. In the best case, developers can work around this with various hacks. In the worst case, it causes user-facing pain in the form of lost state and broken back buttons, or the inability to achieve the desired navigation flow for a web app.
Standards & signals
- Specification: https://wicg.github.io/navigation-api
- Firefox: Positive — Initial positive opinions on the issue, and continued engagement on the design, but not yet an official position
- Safari: No signal
- Web developers: Strongly positive — The initial public proposal, as well as the issue tracker and Twitter, has had great engagement and enthusiasm from developers.
Origin trial feedback was also encouraging.
In addition, we have several conversations going on with frameworks, libraries, and larger websites to ensure that we're solving the problems they see with today's history API. So far reactions have been either positive, or requesting that we add additional functionality (most notably https://github.com/WICG/app-history/issues/32).
- Tracking bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1183545
Docs: https://developer.chrome.com/docs/web-platform/navigation-api
Samples: https://gigantic-honored-octagon.glitch.me/ https://selective-heliotrope-dumpling.glitch.me/
Explainers: https://github.com/WICG/navigation-api/blob/main/README.md
View on chromestatus.com