Single-page applications, or SPAs, are defined by a core feature: dynamically rewriting their content as the user interacts with the site, instead of

Modern client-side routing: the App History API

submited by
Style Pass
2021-08-28 18:30:09

Single-page applications, or SPAs, are defined by a core feature: dynamically rewriting their content as the user interacts with the site, instead of the default method of loading entirely new pages from the server.

While SPAs have been able to bring you this feature via the History API (or in limited cases, by adjusting the site's #hash part), it's a clunky API developed long-before SPAs were the norm—and the web is crying out for a completely new approach. The App History API is a proposed API that completely overhauls this space, rather than trying to simply patch History API's rough edges. (For example, Scroll Restoration patched the History API rather than trying to reinvent it.)

The App History API is currently in development, and available in Chrome 95 and beyond behind the "Experimental Web Platform features" flag. Check out a demo here.

This post describes the App History API at a high level. If you'd like to read the technical proposal, check out the Draft Report in the WICG repository.

Leave a Comment