Document Picture-in-Picture API lets browsers float full web widgets, not just videos
The Document Picture-in-Picture API allows developers to open a floating, always-on-top browser window containing a full HTML document — complete with custom CSS and JavaScript — rather than just a video player. Triggered via window.documentPictureInPicture.requestWindow(), the API accepts options for dimensions and initial placement, and limits each page to one floating window at a time. A tutorial by Daniel Schwarz on CSS-Tricks demonstrates the feature using a stock ticker widget that 'teleports' from the main page into the floating window. Developers must manually clone stylesheets into the new document, as it launches empty, and CSS relying on parent or ancestor context may break without adjustments. Browser support is currently partial — Chrome and Firefox 151 support the API, while Safari does not — so feature detection is recommended before shipping.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in