Persistent Widgets
- Category
- DOM
- Type
- New or changed feature
- Status
- Proposed (Chrome Proposed)
- Intent stage
- None
Summary
Persistent widgets are embedded browsing contexts, like iframes, but they can persist across same-origin navigations without reloading. Persistent widgets can be used via the <persistentwidget> HTML element. The <persistentwidget> HTML element takes a src attribute, like an iframe. In order to make the <persistentwidget> survive a navigation, all of these conditions must be met: 1. The navigation must be to a same-origin document. 2. The <persistentwidget> element must have the same src and id HTML attributes in both documents. 3. The <persistentwidget> element must be attached to the new document before its first render.
Motivation
Hard navigations of top-level documents result in the destruction of all the child iframes of those documents. In cases of same-origin navigations, there's high likelihood that at least some of those iframes would need to be recreated on the new document. For iframes maintaining complex client-side state (e.g. chat widgets, media players, collaborative editing sessions, payment flows, embedded third-party apps), that results in loss of state and user-visible performance implications. This significantly disadvantages MPA architectures (that rely on hard same-origin navigations) compared to SPA architectures, that can soft-navigate parts of the document while leaving the iframes intact. That is particularly problematic for the use-case of in-page agents, and runs a risk of causing web developers to prefer SPAs due to that, despite potential performance and maintenance costs related to that preference.
Standards & signals
- Firefox: No signal
- Safari: No signal
- Web developers: No signals
- Tracking bug: https://issues.chromium.org/issues/537818859
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=persistent-widgets
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+Persistent%20Widgets
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=Persistent%20Widgets
- Baseline status: https://webstatus.dev/?q=Persistent%20Widgets
Explainers: https://github.com/WICG/persistent-iframes