Recommended Free Tools
The Document Picture-in-Picture API lets a web app put an interactive HTML widget in a small, always-on-top window while the user works elsewhere. Unlike the older video Picture-in-Picture API, it can display a whole document—not just a video element. To build for it, detect support, open the window in response to a user action, move or render the widget into its separate document, and restore it when that window closes.
What the Document Picture-in-Picture API does
The API opens a floating window that a site can populate with arbitrary HTML. That makes it useful for interfaces that need to stay visible without taking over the main page: for example, meeting controls alongside video, a notes panel, a task list, or messaging controls. The Chrome for Developers guide describes the window as similar to a blank same-origin window, but it floats above other windows, cannot be navigated, cannot be positioned by the website, and does not outlive the page that opened it. Chrome for Developers explains the API and its behavior.
As an Amazon Associate I earn from qualifying purchases.
Document PiP versus video PiP
| Aspect | Document Picture-in-Picture | Video Picture-in-Picture |
|---|---|---|
| Content | A separate HTML document that can contain arbitrary page elements. | A video element. |
| Interface options | Can include custom controls and other interactive elements alongside media or independently. | Designed for presenting video, rather than a general-purpose HTML interface. |
| Implementation work | Requires handling the separate document’s styles and the widget’s move or render and restore lifecycle. | The cited Chrome guide distinguishes it by its video-only content scope; it does not establish equivalent document-styling work. |
| Browser support | Limited availability; check support in each target browser. | Support varies by browser and platform; confirm it for the audience you serve. |
The distinction is about what the floating window can contain, not merely how it looks. Use Document PiP when the feature is an interface; use video PiP when the need is specifically to keep a video visible. The Chrome guide covers the content distinction, while MDN documents Document PiP support status.
How to create a basic widget
The sequence below shows the core pattern: check availability, request the window from a user gesture, put the widget in its document, and return it when the window is dismissed.
#1 Best Overall
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
-
Feature-detect the API
Check for
documentPictureInPictureonwindow. Keep the regular page usable if it is absent; support is limited and implementation-dependent. MDN marks the API as limited availability, and the specification leaves support implementation-defined. -
Request the window after a user action
Call
requestWindow()in a click handler or another user-initiated action. It returns a promise that resolves to the PiP window; a request without a user gesture can be rejected. Optionalwidthandheightvalues request an initial size, but the browser may adjust them. Chrome’s implementation guide documents the request and sizing behavior.Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
-
Place the widget in the PiP document
After the promise resolves, append the widget to the returned window’s document. Moving an existing DOM element removes it from its former parent, so decide what should occupy that space in the main page and where the element should go when PiP closes.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Provide styles for the separate document
The PiP window has its own document; styles from the opener do not automatically become styles in that document. Copy or add the CSS the widget needs. The Chrome guide demonstrates copying linked and embedded stylesheets and notes that the copy happens once, so later style changes in the opener are not automatically synchronized. Its guide also describes the
display-mode: picture-in-pictureCSS rule for Chrome 123 and later; verify support in your target browsers before relying on it. See Chrome’s styling guidance.Rank #3
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
-
Restore the widget when the window closes
Listen for
pagehideon the PiP window and move the element back into the main document. Restore any related page controls or layout state at the same time. The window can be closed through browser UI, and it also closes if its opener is destroyed. MDN’s usage guide demonstrates handlingpagehide.
if ('documentPictureInPicture' in window) {
openButton.addEventListener('click', async () => {
const pipWindow = await window.documentPictureInPicture.requestWindow({
width: widget.clientWidth,
height: widget.clientHeight,
});
pipWindow.document.body.append(widget);
pipWindow.addEventListener('pagehide', () => {
originalContainer.append(widget);
});
});
}
This illustrative pattern omits application-specific handling. Before using it in production, account for the widget’s current parent, styles, repeated open-and-close actions, and request errors. Ensure the restore target exists and that the rest of the app remains consistent if the request fails.
Rank #4
- 5 in 1 Connectivity: The USB C Multiport Adapter is equipped with a 4K HDMI port, a 100W USB C PD port, a 5 Gbps USB A data port, and two 480 Mbps USB A ports
Support and status
MDN labels the API “Limited availability” and says it is available only in secure contexts in browsers that support it. The WICG specification says support is implementation-defined and is not a W3C Standard or on the W3C Standards Track. Chrome’s developer guide lists the feature as launched for desktop, but that does not establish support across all browsers or platforms. Check current compatibility for the browsers and devices your users rely on before making PiP essential to a workflow. MDN’s API reference, the WICG specification, and the Chrome guide describe these status details.
The Chrome guide gives version thresholds for some enhancements: resizing in Chrome 121, opener focus in Chrome 123, the PiP display-mode CSS feature in Chrome 123, disallowReturnToOpener in Chrome 124, and preferInitialWindowPlacement in Chrome 130. These are Chrome-specific version notes, not guarantees for other browsers; confirm current behavior before using an enhancement.
Quick Recap
Best Value
- Ultra-Fast Data Transfers: Experience the power of 5Gbps transfer speeds with this USB hub and sync data in seconds, making file transfers a breeze.
- Long Cable, Endless Convenience: Say goodbye to short and restrictive cables. This USB hub comes with a 2 ft long cable, giving you the freedom to connect your devices exactly where you need them.
- Sleek and Compact: Measuring just 4.2 × 1.2 × 0.4 inches, carry the USB hub in your pocket or laptop bag and connect effortlessly wherever you go.
- Instant Connectivity: Anker USB-C data hub offers a true plug-and-play experience, instantly connecting your devices and enabling seamless file transfers.
- What You Get: 2ft Anker USB-C Data Hub (4-in-1, 5Gbps) , welcome guide, our worry-free 18-month warranty, and friendly customer service.
Lifecycle and design constraints to plan for
- Only one Document PiP window: The specification permits at most one such window per top-level browsing context. Design the app so a second widget does not assume it can open another independent Document PiP window. The WICG specification.
- No screen-position control: A site cannot choose where the browser places the floating window. Avoid instructions or layouts that depend on a specific screen location. Chrome’s guide.
- The opener owns the window’s lifetime: The PiP window closes when the page that opened it is destroyed. Save important widget state in the application rather than treating the floating window as a persistent independent page. The specification.
- Separate styling and layout: Moving an element into another document changes its DOM context. Keep its CSS available there and define how the main page should look while the element is away and after it returns. Chrome’s guide and MDN’s usage guide.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




