JavaScript Document pictureInPictureEnabled Property

Beginner
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Limited availability
Instance property

What You’ll Learn

Document.pictureInPictureEnabled is a read-only instance property that tells you whether picture-in-picture (PiP) mode is available for this document. Learn how to guard requestPictureInPicture(), how it differs from pictureInPictureElement, Permissions-Policy notes, and five examples with try-it labs.

01

Kind

Read-only property

02

Returns

boolean

03

Means

Can use PiP?

04

vs

PiP element

05

Guard

Before request

06

Status

Limited avail.

Introduction

Before calling video.requestPictureInPicture(), it helps to know whether the browser will allow it. document.pictureInPictureEnabled answers that question with a simple true or false.

MDN: the read-only property indicates whether or not picture-in-picture mode is available. Picture-in-picture is available by default unless a Permissions-Policy turns it off. It pairs with pictureInPictureElement in the Picture-in-Picture API.

💡
Limited availability

MDN marks this property Limited availability (not Baseline). It is not Deprecated, Experimental, or Non-standard—still feature-detect ("pictureInPictureEnabled" in document) before relying on it.

Related Document tutorials: pictureInPictureElement, fullscreenEnabled, Document constructor.

Understanding Document.pictureInPictureEnabled

A read-only instance property on Document that reports Picture-in-Picture API availability—not whether PiP is currently active.

  • Valuetrue if a video can enter PiP via requestPictureInPicture(); otherwise false (MDN).
  • Default — MDN: available by default unless a Permissions-Policy disables it.
  • Lenient setter — assigning does not throw; the write is ignored (MDN).
  • Pair with — check before requestPictureInPicture(); use pictureInPictureElement to see the active element.
  • UI tip — hide or disable PiP buttons when the value is false.

📝 Syntax

JavaScript
document.pictureInPictureEnabled

Value

A boolean: true when picture-in-picture can be requested; false when it cannot (MDN).

MDN guard example

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

⚡ Quick Reference

GoalCode / note
Is PiP allowed?document.pictureInPictureEnabled
Guard before requestif (document.pictureInPictureEnabled) { ... }
Is PiP active?document.pictureInPictureElement !== null
Feature detect"pictureInPictureEnabled" in document
Policy noteMay be disabled by Permissions-Policy (MDN)
MDN statusLimited availability (not Baseline)

🔍 At a Glance

Four facts about document.pictureInPictureEnabled.

Type
boolean

Read-only

true
can enter

PiP available

false
blocked

Not allowed

Status
limited

Not Baseline

📋 pictureInPictureEnabled vs pictureInPictureElement

pictureInPictureEnabledpictureInPictureElement
TypebooleanElement | null
QuestionCan we enter PiP?What is in PiP now?
Typical useEnable/disable PiP buttonsToggle exit / inspect target
When false/nullAPI blocked for this documentNot currently in PiP

Examples Gallery

Examples follow MDN Document: pictureInPictureEnabled. On most supporting browsers the value is true unless a policy blocks PiP.

📚 Getting Started

Read the property and use MDN’s guard pattern.

Example 1 — Read pictureInPictureEnabled

Log whether picture-in-picture is available on this document.

JavaScript
console.log(document.pictureInPictureEnabled);
console.log("PiP available?", document.pictureInPictureEnabled === true);
Try It Yourself

How It Works

A boolean is enough to decide whether to show PiP controls in your player UI.

Example 2 — MDN Guard Before requestPictureInPicture()

Only request PiP when the feature is enabled (MDN example).

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

How It Works

Checking first avoids confusing errors when the API is missing or blocked by policy.

📈 UI, Status & Detection

Wire buttons, compare with the active PiP element, and feature-detect.

Example 3 — Enable or Disable a PiP Button

Hide unsupported controls so users never click a dead button.

JavaScript
const btn = document.getElementById("pip");
btn.disabled = !document.pictureInPictureEnabled;
btn.title = document.pictureInPictureEnabled
  ? "Open picture-in-picture"
  : "Picture-in-picture is not available";
Try It Yourself

How It Works

Availability is a document-level fact; active PiP state is separate and can change later.

Example 4 — Availability vs Active Element

Enabled means you can enter PiP; the element property means you are in PiP.

JavaScript
console.log("Available?", document.pictureInPictureEnabled);
console.log("Active element?", document.pictureInPictureElement);
// Available can be true while Active element is still null
Try It Yourself

How It Works

Use both properties together: enable the feature, then track which video is in the floating window.

Example 5 — Feature-Detect Safely

Older browsers may not expose the property at all.

JavaScript
const supportsPiP =
  "pictureInPictureEnabled" in document &&
  document.pictureInPictureEnabled;

console.log("Safe to offer PiP?", supportsPiP);
Try It Yourself

How It Works

The in check avoids reading undefined on engines that never implemented the API.

🚀 Common Use Cases

  • Guard requests — MDN pattern before requestPictureInPicture().
  • Player chrome — show/hide a PiP icon based on availability.
  • Feature flags — combine with "pictureInPictureEnabled" in document.
  • Policy debugging — investigate Permissions-Policy blocks when the value is unexpectedly false.
  • Pair with status — use pictureInPictureElement after a successful enter.
  • Parallel to fullscreen — same “enabled vs active” mental model as fullscreenEnabled.

🧠 How PiP Availability Works

1

Browser loads the document

Support and site policies decide whether PiP is allowed.

Load
2

Read pictureInPictureEnabled

true means videos may call requestPictureInPicture().

Check
3

User gesture enters PiP

On success, pictureInPictureElement points at the video.

Enter
4

Enabled stays separate from active

Closing PiP sets the element back to null; availability can remain true.

📝 Notes

  • MDN: Limited availability (not Baseline) — no Deprecated / Experimental / Non-standard banner.
  • Assigning to the property is a no-op; it never throws, even in strict mode (MDN).
  • PiP is available by default unless a Permissions-Policy disables it (MDN).
  • This answers “can we?”; pictureInPictureElement answers “are we?”.
  • Related: pictureInPictureElement, fullscreenEnabled, Document constructor.

Browser Support

Document.pictureInPictureEnabled is marked Limited availability on MDN (not Baseline). Feature-detect before production use. Logos use the shared browser-image-sprite.png sprite from this project.

Limited availability · Not Baseline

Document.pictureInPictureEnabled

Read-only boolean — whether picture-in-picture mode is available for this document.

Limited Check compat
Google Chrome Supported · Desktop & Android
Supported
Mozilla Firefox Supported in modern versions
Supported
Apple Safari Limited / platform-dependent PiP
Partial
Microsoft Edge Chromium PiP support
Supported
Opera Follow Chromium behavior
Supported
Internet Explorer No Picture-in-Picture API
Not supported
Document.pictureInPictureEnabled Limited availability

Bottom line: Check pictureInPictureEnabled before requestPictureInPicture(). Pair with pictureInPictureElement to track the active PiP element.

Conclusion

Document.pictureInPictureEnabled is the availability switch for picture-in-picture. Guard requestPictureInPicture() with it, mirror the fullscreenEnabled pattern, and use pictureInPictureElement once PiP is active.

Continue with plugins, pictureInPictureElement, fullscreenEnabled, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Check document.pictureInPictureEnabled before requesting PiP (MDN)
  • Feature-detect with "pictureInPictureEnabled" in document
  • Disable PiP UI when the value is false
  • Start PiP only from a user gesture
  • Track active state with pictureInPictureElement

❌ Don’t

  • Assign to pictureInPictureEnabled expecting to change policy
  • Confuse availability with “currently in PiP”
  • Assume every browser is Baseline for this API
  • Ignore Permissions-Policy when the value is unexpectedly false
  • Call requestPictureInPicture() without a fallback message

Key Takeaways

Knowledge Unlocked

Five things to remember about pictureInPictureEnabled

Boolean availability — guard before requesting PiP.

5
Core concepts
02

true

PiP allowed

Available
🛡03

Guard

before request

MDN
🎬04

vs

PiP element

Active
🔎05

Detect

in document

Safe

❓ Frequently Asked Questions

A boolean: true if a video can enter picture-in-picture and display in a floating window via HTMLVideoElement.requestPictureInPicture(), or false if PiP is not available (MDN).
No. MDN does not mark Document.pictureInPictureEnabled as 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 mode.
When the browser does not support PiP for this document, or when a Permissions-Policy (or similar policy) disables picture-in-picture. MDN notes PiP is available by default unless specified otherwise by a Permissions-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 it first so you can show a friendly message instead of a failed request.
Did you know?

MDN notes that although pictureInPictureEnabled is read-only, assigning to it does not throw—even in strict mode. The setter is ignored. Site owners who need to turn PiP off should use a Permissions-Policy header (or equivalent), not JavaScript assignment.

Next: plugins

Learn the live HTMLCollection of every <embed> element (same as embeds).

plugins →

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.

6 people found this page helpful