The window.appHistory API provides the ability to intercept navigations as well as introspect an application's history entries. This provides a more useful alternative to window.history, specifically aimed at the needs of single-page web applications.
The biggest interoperability risk with this API is that it is building on a rocky foundation. The existing session history spec does not match browsers very well, and browsers do not match each other. Since this new API layers on top of the existing model, this could cause issues. We plan to address this by having solid and well-tested specifications for all aspects of the new API, as well as every way the new API integrates with window.history. Additionally, we're working in parallel to improve interoperability on the base model through spec updates, writing web platform tests, and fixing browser bugs.
Although this API layers onto the same underlying model as window.history, and will have well-specified interactions with it, the exact integrations may be confusing. (For example, appHistory.navigate() will behave differently from history.pushState().) We'll do our best to smooth over these rough edges where possible, but will favor making the app history API pleasant to use over making it perfectly align with window.history. From a performance standpoint, there are some potential challenges regarding exposing information and intercepting navigations that are usually handled in the browser process to the renderer process, and ensuring everything stays synchronized. We will explore this further as we prototype.
This feature is hard to polyfill, but developers have managed to produce something that works in many cases: https://github.com/frehner/appHistory We've also seen a pattern where developers have existing history wrappers (e.g. router libraries or app-specific history code) which they can adapt with a new app history-based backend for browsers that support it.
We believe the security risks of this feature are minimal because of how it is scoped to same-origin contiguous history entries, and similarly only allows interception of same-origin navigations. We also need to ensure that we don't allow "trapping" the user by preventing them from using their back button; the API is designed to prevent this.
We have much of the core API developed, and want to validate that it helps developers in production. At least one large site is interested in swapping out their existing history API wrapper for one based on app history, and we want to validate that doing so produces the expected code simplifications and opportunities for new capabilities like loading spinner control. And, we want to validate that running it in production does not expose any new bugs that we have missed during dev trials.
This feature mostly has no need for extended tooling. https://bugs.chromium.org/p/chromium/issues/detail?id=1252940 tracks adding the newly-introduced events to the Event Listener Breakpoints panel.
Contact emails
dom...@chromium.org, jap...@chromium.orgExplainer
https://github.com/WICG/app-history/blob/main/README.mdSpecification
https://wicg.github.io/app-history/Summary
The window.appHistory API provides the ability to intercept navigations as well as introspect an application's history entries. This provides a more useful alternative to window.history, specifically aimed at the needs of single-page web applications.
Blink component
Blink>HistoryTAG review
https://github.com/w3ctag/design-reviews/issues/605
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAM0wra_dVUPAFLrKYT6E7_tUO31B6w8Tt6ir1-OEETdf%2B-Atdw%40mail.gmail.com.