JavaScript Element fullscreenerror Event

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

What You’ll Learn

The fullscreenerror event fires when the browser cannot switch to fullscreen. Learn onfullscreenerror, why requests fail, how it pairs with requestFullscreen() Promise rejection, and five try-it labs.

01

Kind

Instance event

02

Type

Event

03

When

Fullscreen request fails

04

Handler

onfullscreenerror

05

Also check

Promise .catch()

06

Status

Limited availability

Introduction

Fullscreen is powerful—and often restricted. If requestFullscreen() is denied, the element does not go fullscreen. Instead you get a fullscreenerror event (and usually a rejected Promise).

Treat this event as your UX safety net: show a friendly message, offer a non-fullscreen fallback, and keep the rest of the app working. MDN marks it as Limited availability (not Baseline)—feature-detect and test.

💡
Beginner tip

The most common beginner mistake is calling requestFullscreen() outside a click/key handler. Many browsers deny that and fire fullscreenerror.

Understanding fullscreenerror

An instance event that answers: “Did the fullscreen mode change fail for this element?”

  • Fires when the browser cannot switch into (or sometimes out of) fullscreen.
  • Two deliveries — first to the Element, then to its Document (like fullscreenchange).
  • Not cancelable — you cannot force fullscreen by calling preventDefault().
  • Event type — a plain Event (no rich error code on the event itself).
  • Handleronfullscreenerror or addEventListener("fullscreenerror", ...).
  • Limited availability on MDN (not Baseline)—test carefully.

📝 Syntax

Use the event name with addEventListener, or set the handler property:

JavaScript
addEventListener("fullscreenerror", (event) => { });

onfullscreenerror = (event) => { };

Event type

A generic Event. Not cancelable.

Success vs failure path

OutcomeWhat you get
SuccessPromise resolves + fullscreenchange
FailurePromise rejects + fullscreenerror

⚠️ Why Fullscreen Requests Fail

  • No user gesture — call from a click/key handler, not a bare timer.
  • Iframe policy — nested frames often need allow="fullscreen".
  • Permissions Policy — the page or parent may block the fullscreen feature.
  • Unsupported content — some element types / plugins cannot go fullscreen.
  • Detached nodes — if the element left the document, events may go to the Document instead.

See MDN’s Guide to the Fullscreen API for more failure cases.

⚖️ fullscreenerror vs fullscreenchange

Topicfullscreenchangefullscreenerror
MeaningMode already changedMode change failed
Typical next stepUpdate UI from fullscreenElementShow error / fallback
PromiseResolves on successRejects on failure
Cancelable?No (generic Event)No

⚡ Quick Reference

GoalCode / note
Listen on elementel.addEventListener("fullscreenerror", fn)
Handler propertyel.onfullscreenerror = fn
Listen on documentdocument.addEventListener("fullscreenerror", fn)
Catch Promise tooel.requestFullscreen().catch(handler)
MDN statusLimited availability (not Baseline)

🔍 At a Glance

Four facts to remember about fullscreenerror.

Event type
Event

Plain Event

Means
FS failed

Could not switch

Also
.catch()

Promise rejects

Baseline
no

Limited availability

Examples Gallery

Examples follow MDN Element: fullscreenerror event. Some labs intentionally trigger failures (for example calling without a user gesture).

📚 Getting Started

MDN-style listener and the handler property.

Example 1 — addEventListener("fullscreenerror") (MDN)

Log when a fullscreen mode change fails.

JavaScript
const requestor = document.querySelector("div");

function handleError(event) {
  console.error("an error occurred changing into fullscreen");
  console.log(event);
}

requestor.addEventListener("fullscreenerror", handleError);
// or
requestor.onfullscreenerror = handleError;

requestor.requestFullscreen();
Try It Yourself

How It Works

MDN’s sample calls requestFullscreen() immediately. In many browsers that fails and is a great way to see fullscreenerror fire.

Example 2 — onfullscreenerror Property

Update a status line when the handler property receives the event.

JavaScript
const el = document.getElementById("fs");
const out = document.getElementById("out");

el.onfullscreenerror = () => {
  out.textContent = "fullscreenerror: could not change mode";
};

document.getElementById("bad").addEventListener("click", () => {
  // Still may fail in some environments (iframe / policy)
  el.requestFullscreen();
});
Try It Yourself

How It Works

Prefer addEventListener when you need multiple listeners. Keep the property form for tiny demos.

📈 Promise, Gesture & UX

Handle both signals, reproduce a common failure, show a fallback.

Example 3 — Event + Promise .catch()

Production pattern: listen for the event and catch the Promise rejection.

JavaScript
const el = document.getElementById("fs");
const out = document.getElementById("out");

el.addEventListener("fullscreenerror", () => {
  out.textContent = "Event: fullscreenerror";
});

document.getElementById("go").addEventListener("click", () => {
  el.requestFullscreen().catch((err) => {
    out.textContent =
      "Promise rejected: " + (err && err.message ? err.message : String(err));
  });
});
Try It Yourself

How It Works

The Promise rejection may include a useful message; the event is the DOM signal other code can observe. Handling both is the robust approach.

Example 4 — Failure Without a User Gesture

Call requestFullscreen() from a timer to demonstrate a common denial.

JavaScript
const el = document.getElementById("fs");
const out = document.getElementById("out");

el.addEventListener("fullscreenerror", () => {
  out.textContent = "fullscreenerror (likely no user gesture / policy)";
});

document.getElementById("arm").addEventListener("click", () => {
  out.textContent = "Calling requestFullscreen in 500ms without a gesture...";
  setTimeout(() => {
    el.requestFullscreen().catch(() => {
      out.textContent += "\nPromise also rejected.";
    });
  }, 500);
});
Try It Yourself

How It Works

The button arms a timer; the delayed call is no longer a direct user gesture in many engines. Always request fullscreen synchronously inside the gesture handler when you can.

Example 5 — Friendly Error UI + Fallback

Show a message and keep a windowed “maximize” class as a fallback.

JavaScript
const el = document.getElementById("fs");
const msg = document.getElementById("msg");
const btn = document.getElementById("go");

el.addEventListener("fullscreenerror", () => {
  msg.textContent = "Fullscreen blocked here. Using a large windowed layout instead.";
  el.classList.add("is-maximized");
});

el.addEventListener("fullscreenchange", () => {
  if (document.fullscreenElement) {
    msg.textContent = "Fullscreen OK";
    el.classList.remove("is-maximized");
  }
});

btn.addEventListener("click", () => {
  el.requestFullscreen().catch(() => {
    // Event handler also updates UI; catch avoids unhandled rejection.
  });
});
Try It Yourself

How It Works

Never leave users stuck with a silent failure. Pair the error event with a clear message and an alternative experience.

🚀 Common Use Cases

  • Show “Fullscreen not available” toasts in video / game UIs.
  • Fall back to a CSS maximized panel when the API is blocked.
  • Log analytics for permission / iframe / gesture failures.
  • Teach why user gestures matter for privileged browser APIs.
  • Central document-level error handlers for multi-widget apps.

🔧 How It Works

1

Code calls requestFullscreen()

Browser checks gesture, permissions, and element eligibility.

Request
2

Permission denied / unsupported

Mode does not change; fullscreenElement stays as before.

Fail
3

fullscreenerror on Element, then Document

Promise from requestFullscreen() also rejects.

Events
4

Your handler updates UX

Message, log, or windowed fallback—never fail silently.

📝 Notes

  • MDN: Limited availability (not Baseline)—test the browsers you support.
  • Not Deprecated, Experimental, or Non-standard — no status banner required.
  • The event is not cancelable.
  • Handle both fullscreenerror and Promise .catch().
  • Related learning: fullscreenchange, gesturechange, addEventListener(), JavaScript hub.

Limited Availability Support

fullscreenerror is marked Limited availability on MDN (not Baseline). Logos use the shared browser-image-sprite.png sprite from this project. Pair it with feature detection and remember iframes / Permissions Policy can still block fullscreen even when the event exists.

Limited availability

Element fullscreenerror

Failure signal for Fullscreen API requests; confirm support in your target browsers.

Limited Not Baseline
Google Chrome Supported (check BCD / iframe policy)
Supported
Mozilla Firefox Supported; may log console details
Supported
Apple Safari Supported with platform quirks
Supported
Microsoft Edge Supported · Chromium
Supported
Opera Supported · Modern versions
Supported
Internet Explorer No modern Fullscreen API
No
fullscreenerror Limited

Bottom line: Listen for fullscreenerror, catch Promise rejections, and always provide a fallback UX.

Conclusion

fullscreenerror is the Fullscreen API’s failure signal. Listen for it, catch requestFullscreen() rejections, fix gesture / iframe / policy issues when you can, and always give users a clear fallback.

Continue with gesturechange, addEventListener(), or the JavaScript hub.

💡 Best Practices

✅ Do

  • Request fullscreen from a direct user gesture
  • Listen for fullscreenerror and use .catch()
  • Show a human-readable message when it fails
  • Set allow="fullscreen" on trusted iframes that need it
  • Offer a windowed maximize fallback

❌ Don’t

  • Assume every requestFullscreen() will succeed
  • Ignore unhandled Promise rejections
  • Expect the event object to include a rich error code
  • Assume Baseline Widely available status
  • Overwrite onfullscreenerror if you need multiple listeners

Key Takeaways

Knowledge Unlocked

Five things to remember about fullscreenerror

Fullscreen failed—handle the event and Promise; always fall back.

5
Core concepts
📄 02

Event

plain Event

API
🔒 03

Common cause

no user gesture

Gotcha
📤 04

Also .catch()

Promise rejects

Pattern
🎯 05

Limited avail.

not Baseline

Status

❓ Frequently Asked Questions

It fires when the browser cannot switch an element into (or sometimes out of) fullscreen mode. As with fullscreenchange, the event is sent to the Element first, then to its Document.
No. MDN does not mark it Deprecated, Experimental, or Non-standard. It has Limited availability (not Baseline), so always test the browsers you care about.
Common reasons: no user gesture, iframe without allow="fullscreen", Permissions Policy blocking fullscreen, unsupported content, or the browser denying permission.
A generic Event. The event is not cancelable and does not carry a rich error code — pair it with the Promise rejection from requestFullscreen() for details when available.
Either works. MDN notes two fullscreenerror events fire: first on the Element, then on the Document. Listening on document is handy for app-wide error UI.
Success path: requestFullscreen resolves and fullscreenchange fires. Failure path: the Promise rejects and fullscreenerror fires instead of a successful mode change.
Did you know?

Like fullscreenchange, MDN documents two fullscreenerror events: first on the Element that failed, then on the Document that owns it. A single document listener can cover your whole page.

Next: gesturechange

See WebKit’s non-standard mid-gesture pinch/rotate event.

gesturechange →

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.

5 people found this page helpful