JavaScript Document pictureInPictureEnabled Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Property

Definition

Document.pictureInPictureEnabled is a read-only Boolean that is true when a video may enter picture-in-picture (floating window) via HTMLVideoElement.requestPictureInPicture(), otherwise false (MDN).

Read the notes below before you get or set this property. Prefer feature detection when support is limited.

Syntax

Use document.pictureInPictureEnabled. Start with this line.

JavaScript
document.pictureInPictureEnabled
CallWhat it does
document.pictureInPictureEnabledPrimary signature.

Built into the browser. Read or assign document.pictureInPictureEnabled — no import required.

Library declarations
JavaScript
document.pictureInPictureEnabled

Parameters

ParameterDescription
Permissions-PolicyOptional. Can deny PiP (MDN)

Return Value

Return ValueDescription
*Boolean (true / false)

JavaScript Examples

Example 1 — Read pictureInPictureEnabled

Log whether picture-in-picture is available in the current document.

JavaScript
console.log(document.pictureInPictureEnabled);
// true or false
Try It Yourself

How It Works

  1. Read the Boolean. No arguments — access document.pictureInPictureEnabled.
  2. Interpret true. A video may call requestPictureInPicture().
  3. Interpret false. Do not offer PiP (or explain why).
  4. Policy matters. Permissions-Policy can turn support off (MDN).

Example 2 — Guard Before requestPictureInPicture() (MDN)

Check availability first, then enter — or log a friendly message.

JavaScript
function requestPictureInPicture(videoElement) {
  if (document.pictureInPictureEnabled) {
    videoElement.requestPictureInPicture();
  } else {
    console.log("Your browser cannot use picture-in-picture right now");
  }
}

// Demo without starting real PiP:
if (document.pictureInPictureEnabled) {
  console.log("PiP is available — safe to call requestPictureInPicture().");
} else {
  console.log("Your browser cannot use picture-in-picture right now");
}
Try It Yourself

How It Works

  1. Gate the call. Only request PiP when the flag is true.
  2. Avoid failed attempts. When false, skip requestPictureInPicture().
  3. Tell the user. MDN’s message pattern keeps UX clear.
  4. Still need a gesture. Browsers usually require a click even when enabled.

Example 3 — Enabled vs Currently Active

Availability is not the same as “in picture-in-picture now.”

JavaScript
const allowed = document.pictureInPictureEnabled;
const active = document.pictureInPictureElement !== null;

console.log(allowed);  // can we enter PiP?
console.log(active);   // are we in PiP now?

// Common combo: allowed && !active → show "Enter PiP"
Try It Yourself

How It Works

  1. Read capability. pictureInPictureEnabled answers “is PiP allowed?”
  2. Read state. pictureInPictureElement !== null answers “are we in PiP?”
  3. Typical combo. Allowed + not active → show an Enter control.
  4. Do not mix them up. A page can allow PiP and still not be in PiP.

Browser Support

Document.pictureInPictureEnabled is marked Limited availability on MDN (not Baseline). It is not Deprecated, Experimental, or Non-standard — still feature-detect in production.

✓ Limited availability · Not Baseline

Document.pictureInPictureEnabled

Read-only Boolean — true when HTMLVideoElement.requestPictureInPicture() is allowed for this document.

Ltd Limited availability
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
pictureInPictureEnabled Limited

Bottom line: Check document.pictureInPictureEnabled before calling requestPictureInPicture(). Pair with pictureInPictureElement for current state, and exit with document.exitPictureInPicture().

Frequently Asked Questions

A boolean: true if a video can enter picture-in-picture via HTMLVideoElement.requestPictureInPicture(), or false if PiP is not available (MDN).
No. MDN does not mark it Deprecated, Experimental, or Non-standard. It is Limited availability (not Baseline), so feature-detect in production.
pictureInPictureEnabled asks whether PiP is allowed at all. pictureInPictureElement tells you which element (if any) is currently in picture-in-picture.
When the browser cannot use PiP here, or when a Permissions-Policy disables picture-in-picture. MDN: available by default unless denied by policy.
The property is read-only, but assigning does not throw — even in strict mode. The setter is a no-operation and is ignored (MDN).
Yes. MDN recommends checking first so you can show a friendly message instead of a failed request.

Next: plugins

Learn the Document property that exposes the embeds/plugins collection.

plugins tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful