demo · v130
PiP Placement Demo
Chrome 130 adds preferInitialWindowPlacement to documentPictureInPicture.requestWindow(). Without it, the PiP window re-opens at the same position it was last closed (bounds cache). Set this option to true and the browser ignores the cache, placing the window at a fresh position. This matters when the cached position is on a disconnected monitor or has become stale.
Checking Document PiP API availability…
Simulated screen — PiP window placement:
PiP Window
Position: bottom-right (default fresh placement)
Log: click "Open PiP window" to simulate placement.
Without preferInitialWindowPlacement
Browser reads the bounds cache from last session.
PiP re-opens at last-closed position.
→ Can appear on a disconnected monitor
→ Can overlap important content
→ Stale position after window resize
No way to opt out of the cached position.
PiP re-opens at last-closed position.
→ Can appear on a disconnected monitor
→ Can overlap important content
→ Stale position after window resize
No way to opt out of the cached position.
Chrome 130: preferInitialWindowPlacement: true
Browser ignores the bounds cache.
PiP opens at a fresh default position.
→ Always on an active, visible monitor ✓
→ Consistent placement per open ✓
→ No dependency on stale position data ✓
Previous position is not overwritten.
PiP opens at a fresh default position.
→ Always on an active, visible monitor ✓
→ Consistent placement per open ✓
→ No dependency on stale position data ✓
Previous position is not overwritten.
// Chrome 130: preferInitialWindowPlacement
const pipWindow = await documentPictureInPicture.requestWindow({
width: 480,
height: 270,
preferInitialWindowPlacement: true, // ← NEW in Chrome 130
// true → ignore bounds cache, use fresh default position
// false → use cached position (default behaviour)
});
// The window object is a full document window
pipWindow.document.body.append(videoElement);
// Listen for the PiP window closing
pipWindow.addEventListener('pagehide', () => {
videoElement.remove(); // put video back
});