Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The Document Picture-in-Picture API lets a web app open an always-on-top window containing a full HTML document, so a widget can stay visible while the user works elsewhere. To use it, feature-detect the API, open the window in response to a user action, put the widget element in the new document, provide its styles, and restore it when the window closes. Because support is limited and the PiP window has its own lifecycle, the main app should remain useful without it.

What Document Picture-in-Picture is—and what it is not

Document Picture-in-Picture (Document PiP) opens a floating window that a page can populate with arbitrary HTML. That makes it suitable for interfaces such as a compact task list, notes panel, messaging controls, a video player with custom controls, or multiple conference streams. Chrome for Developers describes it as an always-on-top window populated with arbitrary HTML (Chrome for Developers: Picture-in-Picture for any Element, not just <video>).

It is different from the older video Picture-in-Picture API, which is centered on displaying a video element. Document PiP gives developers room for a richer interface, but also requires them to manage a separate document, styles, and the movement and return of DOM elements.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Aspect Document Picture-in-Picture Video Picture-in-Picture
Content A separate HTML document that can contain arbitrary HTML. A video element.
Interface Can include custom controls and other interactive elements alongside media. Focused on the video presentation.
Implementation work Manage the PiP document, its styles, and widget lifecycle. Does not provide the same arbitrary-document surface.
Browser support Limited availability; check the browsers and versions your users rely on. Support varies by browser and platform; verify it for your audience.

The new window resembles a blank same-origin window in some ways, but it is not an ordinary second tab: it floats above other windows, cannot be navigated by the site, cannot be positioned by the site, and does not outlive its opener. The WICG specification also limits a top-level browsing context to one Document PiP window (WICG: Document Picture-in-Picture Specification).

#1 Best Overall
Sale
LG 34WR55QK-B 34-inch UltraWide WQHD (3440 x 1440) Curved Computer Monitor, 100Hz, 5ms, HDR10, Reader Mode, HDMI, DisplayPort, USB Type-C, Tilt/Height Adjustable Stand, Black
  • 21:9 UltraWide - The 21:9 UltraWide WQHD (3440 x 1440) monitor is great for work. The widescreen allows you to see everything you're working on, with multiple windows open, all on one screen.
  • Color Gamut - Immerse yourself in a world of brilliant color from HDR10 that helps enhance picture quality and up to 99% sRGB color gamut expression to make games pop.
  • OnScreen Control - You can customize the workspace by splitting the display or adjusting basic monitor options with just a few mouse clicks.
  • Multi Task - OnScreen Control supports Picture-by-Picture (PbP) allowing you to configure your monitor to show content from two separate input sources. Play, watch, stream or work from multiple input sources at the same time, on one screen.
  • Connections - Seamlessly connect to external devices or charge your laptop with the convenience of USB Type-C with up to 65W power delivery.

Build a widget with a graceful fallback

The API is not available everywhere. MDN marks DocumentPictureInPicture as limited availability and says it is restricted to secure contexts in supporting browsers (MDN: DocumentPictureInPicture). The specification leaves support implementation-defined and is not a W3C Standard or on the W3C Standards Track. Keep the widget usable in the normal page when the API is missing or a request fails.

1. Check for the API

Feature-detect documentPictureInPicture on window before offering a PiP action. For unsupported browsers, hide or disable that action, or provide a clear alternative such as keeping the widget in the page.

Rank #2
Sale
SAMSUNG 34" ViewFinity S50GC Series Ultra-WQHD Monitor, 100Hz, 5ms, HDR10, AMD FreeSync, Eye Care, Borderless Design, PIP, PBP, LS34C502GANXZA, 2023, Black
  • DO MORE ON ONE SCREEN: See every detail on the wider display featuring a 21:9 aspect ratio; Ultra WQHD provides the simplest way to maximize screen real estate and experience truly seamless multitasking on just one screen.Brightness (Typical) : 300 cd/㎡. Static Contrast Ratio 3000:1.
  • ENJOY A BILLION COLORS W/ INCREDIBLE DEPTH: With HDR10 that displays over 1 billion colors compared to 16.7 million for typical SDR technology, dark colors are darker and the brightest are even brighter; Content is experienced as the creator intended
  • CARE FOR YOUR EYES DAY and NIGHT: An ambient light sensor on the monitor detects lighting in your workstation and automatically adjusts brightness; Eye Saver Mode minimizes excessive blue light, and Flicker Free relieves eye strain
  • SEE CONTENT SMOOTHER, EVEN GAMING: A faster than average refresh rate updates the image on screen more often every second; 100Hz refresh rate reduces lag and motion blur when playing games, watching videos, or working on design projects
  • STAY IN SYNC WITH THE ACTION: AMD Radeon FreeSync keeps the refresh rate of your monitor and graphics card in sync to reduce image tearing for a superfluid entertainment experience; Watch movies and play games without interruptions

2. Request the window from a user action

Call requestWindow() in response to a user gesture, such as a button click. It returns a promise that resolves to the PiP window. The Chrome guide says the request rejects if it is made without a user gesture. Optional width and height values request the initial size; the browser may adjust them (Chrome for Developers: Picture-in-Picture for any Element, not just <video>).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Place the widget in the new document

When the promise resolves, use the returned window’s document and append the widget element. Appending an existing element moves it from its current parent; it does not create a second copy. Plan for the widget’s original container to change while the element is in PiP.

Rank #3
Sale
INNOCN 49" Curved Gaming Monitor 144Hz Ultrawide 32:9 WDFHD 3840 x 1080P, R1800, 99% sRGB, HDR400, USB Type C, DisplayPort, HDMI, Built-in Speakers, Height/Tilt Adjustable - 49C1G
  • 【Curved Ultrawide Monitor 49" & VA】 Premium VA Panel delivers double FHD 1080p resolution up to 144hz( DP1.4) monitor for content creation and gaming, 32:9 aspect ratio bring more wider visual than ordinary 16:9 monitor, capture game details more clearly for quick response. Tilt / Swivel / Height Adjustable meet different viewing visions
  • 【USB Type C, DP and HDMI Ports】49C1G widescreen curved monitor delivers powerful USB C power delivery connectivity and have richful interfaces: 1 x DP 1.4, 1 x USB C 65W, 1 x HDMI 2.1, 2 x USB A, 1 x USB-B, 1 x RJ45, 1 x 3.5MM Audio Jack, you can directly connect your USB C devices such as Laptop, Mac, Phones, Tablets, Gaming Console( like Switch, PS5/4/3, XBOX Series etc) . It's much more convenient
  • 【Adaptive-Sync & HDR 400 Technology】 INNOCN 49C1G ultrawide computer gaming monitor adopt high dynamic range (HDR) technology with professional color gamut (99% sRGB) delivers high contrast 3000:1 and color performance that meets the Display HDR 400 and Adaptive-Sync, bring smooth images and video viewing experience
  • 【Enhanced Comfort & Double Your Experience】: 1800R curvature results in less eye fatigue; The curved screen allows content to be viewed at a glance while proven to limit eye strain compared to flat monitors. Dual FHD ensures enhanced depth in every detail, delivering incredibly realistic images; INNOCN 49C1G 32:9 super ultra wide display maximizes your screen real estate for seamless multitasking on just one computer screen
  • 【Boost Productivity with Ultrawide Display】 Equipped PIP / PBP split screen technology which allowing you to configure your monitor to show content from two separate input sources. Play, watch, stream or work from multiple input sources at the same time, on one screen. You will not go wrong with any details, produce more fun and innovative things with INNOCN monitor. Just turn on and play

4. Add styles for the separate document

The PiP window has its own document, so do not assume the main page’s styles automatically apply. Add or copy the CSS the widget needs. The Chrome guide demonstrates copying linked and embedded stylesheets and notes that this is a one-time copy; later style changes in the opener are not automatically mirrored. Its guide documents CSS display-mode: picture-in-picture rules in Chrome 123 and later. Check support for the browsers you target before depending on that behavior.

5. Restore the widget when PiP closes

The user can close the window through browser UI, and the window also closes when its opener is destroyed. Listen for the PiP document’s pagehide event and move the widget back to its original container, then update the main app’s controls or status. MDN’s usage guide demonstrates this restoration pattern (MDN: Using the Document Picture-in-Picture API).

Rank #4
SANSUI 34-Inch Curved Gaming Monitor UWQHD 3440 x 1440P 200Hz Ultrawide
  • 34 inch Curved 1500R UWQHD(3440 x 1440) @ 200Hz Fast VA Ultrawide Gaming Monitor with AI built-in.
  • Performance: Up to 200Hz Refresh Rate | OD 1ms Response Time丨 FastVA | AI Blue light reduction | AI Crosshair | AI PQ | Sniper Scope | Support VRR with HDMI2.1
  • Ergonomic Stand: Tilt / Kensington Lock: -5°~15°(+/-2°) / Yes丨VESA Compatible (100 x 100mm) | 178° Wide Viewing Angle | PIP/PBP,21:9
  • Input &Output: DP 1.4 (Up to 200)|HDMI2.1 X 2 (Up to 200)|Earphone |No speakers
  • Warranty: SANSUI 34-inch Curved gaming computer monitor support money-back and free replacement warranty from order date within 30 days and lifetime technical support.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Minimal implementation pattern

This illustrative pattern shows feature detection, a user-triggered request, moving one widget element, and restoring it on close. It does not handle every production concern: retain the original parent, handle failed or repeated requests, and ensure the widget’s styles and app state remain correct.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
if ('documentPictureInPicture' in window) {
  openButton.addEventListener('click', async () => {
    try {
      const pipWindow = await window.documentPictureInPicture.requestWindow({
        width: widget.clientWidth,
        height: widget.clientHeight,
      });

      pipWindow.document.body.append(widget);

      pipWindow.addEventListener('pagehide', () => {
        originalContainer.append(widget);
      });
    } catch (error) {
      // Keep the widget available in the main page and report the failure.
    }
  });
}

In a real implementation, define openButton, widget, and originalContainer from your app. Ensure the click handler is attached to a genuine user action, and decide what the interface should do if the request is rejected. If users can reopen the widget, also avoid registering duplicate handlers or attempting to create another PiP window while one is already open.

Best Value
Sale
Dell 27 Monitor S2725QS, 4K UHD IPS, 120Hz, 5ms, FreeSync Premium
  • Improved ComfortView Plus: Reduces harmful blue light emissions to ≤35%, for all-day comfort without sacrificing color accuracy.
  • Refresh rate: A smooth, tear-free experience with AMD FreeSync Premium (refresh rate up to 120Hz) and an ultra-low 0.03ms response time create a captivating experience for work and play.
  • Vivid colors: Immerse yourself in breathtaking 4K visuals with in-plane switching technology. Enjoy vibrant colors with 99% sRGB. The 1500:1 contrast ratio and HDR readiness deliver excellent depth and detail.
  • Re-engineered sound quality: Enjoy more detailed sound with spacious audio featuring greater output power, deeper frequency response and more decibel range than the previous generation.
  • Ultra-thin bezel: Designed with a sleek, modern aesthetic and an ash white finish, this display features ultra-thin bezels for a refined, minimalist design.

Support and lifecycle details to check

  • Secure context: MDN documents the API for secure contexts in supporting browsers. Test the deployment environment, not only a local development setup.
  • Browser and version: Chrome’s guide lists desktop launch as complete and documents version thresholds for some enhancements: resizing in Chrome 121, opener focus and CSS PiP display-mode rules in Chrome 123, disallowReturnToOpener in Chrome 124, and preferInitialWindowPlacement in Chrome 130. These are version-specific guide notes, not a guarantee of current support in every browser or platform; check the target browser’s current documentation.
  • One window per top-level browsing context: Design the app around a single Document PiP window at a time.
  • No screen-position control: The website cannot choose where the browser places the floating window.
  • Opener dependency: The PiP window closes when its opener is destroyed, so it is not a persistent companion window independent of the page.
  • Element movement: Moving a widget changes its document and parent. Consider styles, layout assumptions, event handling, and where it should return after closure.

These constraints are defined in the WICG specification; the API’s availability and browser-specific behavior should be verified for the audience you support.

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.