JavaScript Screen mozEnabled Property

Beginner
⏱️ 12 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Deprecated
Non-standard
Instance property

What You’ll Learn

Screen.mozEnabled is a deprecated, non-standard instance property: a Boolean that controlled the device screen. Setting it to false was meant to turn the screen off. Learn the meaning of the flag, how it paired with mozBrightness, how to feature-detect safely, and why modern pages must not control screen power—with five examples and try-it labs.

01

Kind

Instance property

02

Returns

Boolean

03

Status

Deprecated · Non-standard

04

Access

window.screen

05

Engine

Mozilla legacy

06

Spec

None

Introduction

In some older Mozilla environments (including Firefox OS era APIs), privileged code could turn the device screen on or off through screen.mozEnabled. MDN describes it simply: this Boolean attribute controls the device’s screen. Setting it to false turns the screen off.

That kind of power does not belong on the open web. Modern browsers do not expose a standard way for a random site to blank the physical display. This tutorial covers the legacy property so you can read old snippets—and avoid writing new ones.

JavaScript
console.log(window.screen.mozEnabled);
💡
Beginner tip

On Chrome, Safari, Edge, and modern Firefox builds you will usually see undefined. That is expected. Always feature-detect; never assume the property exists—and never assign false in new apps.

Understanding the Property

MDN: this Boolean attribute controls the device’s screen. Setting it to false will turn off the screen.

  • Instance — on window.screen where supported.
  • Historically read/write — not a modern cross-browser API.
  • Boolean — screen on (true) vs off (false).
  • Deprecated & Non-standard — not in any specification.

📝 Syntax

JavaScript
// Read (legacy only)
const on = window.screen.mozEnabled;

// Write (legacy only — do not use in new apps)
// window.screen.mozEnabled = false; // would turn the screen off

Value

A boolean. When the API existed, false meant turn the screen off. Pair it mentally with mozBrightness (backlight level)—both were Mozilla screen-power helpers, both are deprecated.

🔄 mozEnabled vs mozBrightness

PropertyMeaning (legacy)
screen.mozEnabledBoolean on/off for the device screen
screen.mozBrightnessNumber 01 for backlight intensity
BothDeprecated · Non-standard · not for new web apps
🔒
Safety tip

Turning a user’s screen off from a website would be surprising and invasive. Modern platforms keep power control with the OS. This tutorial never assigns false in live demos.

🎯 What To Do Instead

GoalModern approach
Save power / sleepOS power button, sleep timeout, user settings
Hide page contentUI overlays, route changes, CSS visibility—not hardware off
Legacy Firefox OS codeRemove mozEnabled; do not port to the open web
Screen diagnosticsStandard screen.height, availHeight, etc.

🛡️ Feature Detection Pattern

Wrap every access. Unsupported browsers should log a clear message and skip writes.

JavaScript
function getMozEnabled() {
  if (!("mozEnabled" in window.screen)) {
    return { supported: false, value: null };
  }
  return { supported: true, value: Boolean(window.screen.mozEnabled) };
}

console.log(getMozEnabled());

⚡ Quick Reference

GoalCode / note
Feature-detect"mozEnabled" in screen
Read (legacy)screen.mozEnabled
Turn off (legacy)screen.mozEnabled = false — do not use
Related legacyscreen.mozBrightness
MDN statusDeprecated · Non-standard
New codeDo not use

🔍 At a Glance

Four facts about screen.mozEnabled.

Kind
property

Legacy r/w

Type
boolean

Screen on/off

Via
window.screen

When present

Status
deprecated

Non-standard

Examples Gallery

Examples follow MDN Screen.mozEnabled. On modern browsers the demos print “not supported”—that is the correct teaching outcome. No example turns the display off.

📚 Getting Started

Detect support and read safely without changing the display.

Example 1 — Feature-Detect mozEnabled

Check whether the property exists on screen.

JavaScript
if ("mozEnabled" in window.screen) {
  console.log("mozEnabled is present (legacy)");
  console.log(typeof screen.mozEnabled);
} else {
  console.log("mozEnabled not supported");
}
Try It Yourself

How It Works

The in operator is the safest first step. Most modern engines take the else branch.

Example 2 — Safe Read with Fallback

Return the boolean only when supported.

JavaScript
function readMozEnabled() {
  if (!("mozEnabled" in screen)) {
    return "(unsupported)";
  }
  return screen.mozEnabled;
}

console.log(readMozEnabled());
console.log(typeof screen.mozEnabled);
Try It Yourself

How It Works

Helpers keep demos readable and avoid treating undefined as a real on/off state.

📈 Labels, Write Ideas & Snapshots

Explain the boolean and contrast it with standard Screen metrics.

Example 3 — Friendly On/Off Label

Map a supported value to a short human-readable string.

JavaScript
function labelMozEnabled() {
  if (!("mozEnabled" in screen)) {
    return "unsupported (do not use in new apps)";
  }
  return screen.mozEnabled
    ? "screen reported on (legacy)"
    : "screen reported off (legacy)";
}

console.log(labelMozEnabled());
Try It Yourself

How It Works

Labels help learners interpret a boolean if they ever meet the API in old docs. Prefer the unsupported message on today’s browsers.

Example 4 — Document the Write Idea (No Assignment)

Show what legacy code looked like without turning anyone’s screen off.

JavaScript
// MDN: setting false would turn the screen off (legacy only)
const legacyIdea = "screen.mozEnabled = false;";

if ("mozEnabled" in screen) {
  console.log("API present; write skipped in this tutorial demo");
  console.log("would have run:", legacyIdea);
} else {
  console.log("API missing; no write attempted");
  console.log("legacy idea only:", legacyIdea);
}
Try It Yourself

How It Works

Teaching the documented behavior as a string keeps the lab safe while matching MDN’s description.

Example 5 — Legacy Flags Plus Standard Screen Snapshot

Show mozEnabled / mozBrightness support next to baseline metrics.

JavaScript
console.log({
  mozEnabled: "mozEnabled" in screen
    ? screen.mozEnabled
    : "(unsupported — deprecated & non-standard)",
  mozBrightness: "mozBrightness" in screen
    ? screen.mozBrightness
    : "(unsupported — deprecated & non-standard)",
  width: screen.width,
  height: screen.height,
  colorDepth: screen.colorDepth
});
Try It Yourself

How It Works

Contrast both legacy Mozilla flags with standard properties like height that you should use today.

🚀 Common Use Cases

  • Reading / migrating old Firefox OS or Mozilla-privileged code.
  • Interview context: why websites must not power off the display.
  • Feature-detection drills for moz* prefixed Screen APIs.
  • Auditing a codebase for deprecated Screen power properties to remove.
  • Pairing with mozBrightness when documenting legacy device APIs.

🔧 How It Works

1

Device screen has power state

OS decides when the display is on or asleep.

Hardware
2

Legacy Mozilla exposed mozEnabled

Boolean on/off for privileged environments (non-standard).

Legacy API
3

Modern browsers omit it

Property missing; feature-detect returns unsupported.

Today
4

Leave power to the OS

Use standard Screen size/color metrics for diagnostics instead.

📝 Notes

Legacy / Deprecated Support

Screen.mozEnabled is Deprecated and Non-standard. It is not part of any specification and is missing or removed in modern browsers. Logos use the shared browser-image-sprite.png sprite from this project. Do not rely on it for production.

Deprecated · Non-standard

Screen.mozEnabled

Legacy Boolean screen on/off — Mozilla-oriented, not for new web apps.

Legacy Avoid in new apps
Mozilla Firefox Legacy / typically removed or unavailable in modern builds
Avoid
Google Chrome Not supported — feature-detect
Unavailable
Microsoft Edge Not supported — feature-detect
Unavailable
Apple Safari Not supported — feature-detect
Unavailable
Opera Not supported — feature-detect
Unavailable
Internet Explorer No mozEnabled support
Unavailable
mozEnabled Deprecated

Bottom line: Feature-detect only for legacy literacy. Never require mozEnabled. Never turn a user’s screen off from a website. Use standard Screen metrics for size and color depth.

Conclusion

window.screen.mozEnabled was a deprecated, non-standard Boolean for turning the device screen on or off in Mozilla environments. Feature-detect if you meet it in old code, expect it to be missing today, and never build products that power off the display from a webpage.

Continue with orientation, mozBrightness, Window methods, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Feature-detect with "mozEnabled" in screen
  • Treat missing support as normal on modern browsers
  • Remove the property from any codebase you maintain
  • Leave screen power / sleep to the OS
  • Prefer standard Screen size / color properties for diagnostics

❌ Don’t

  • Use mozEnabled in new production apps
  • Assign false to blank a user’s display
  • Confuse hiding page UI with turning hardware off
  • Require screen-power control for core product flows
  • Skip reading MDN’s Deprecated and Non-standard warnings

Key Takeaways

Knowledge Unlocked

Five things to remember about mozEnabled

Deprecated non-standard screen on/off flag.

5
Core concepts
⚠️ 02

Deprecated

avoid in new code

Status
🚫 03

Non-standard

no public spec

Spec
🛡️ 04

Detect first

usually missing

Safety
🎯 05

Use OS

not the webpage

Modern

❓ Frequently Asked Questions

On engines that still exposed it, mozEnabled was a Boolean that controlled the device screen. Setting it to false turned the screen off. Access was typically window.screen.mozEnabled.
MDN marks Screen.mozEnabled as Deprecated and Non-standard. It is not Experimental. Do not use it in new code.
Historically yes—it was a Boolean attribute you could read and write. Writing false was meant to power off the screen in supported Mozilla environments.
No. It is a Mozilla-specific, non-standard property and is missing or removed in modern browsers. Always feature-detect; expect undefined elsewhere.
There is no standard web API for turning the physical screen off from a normal webpage. Leave power and sleep to the OS/user. Do not try to blank the device display from site JavaScript.
Both were deprecated non-standard Mozilla Screen properties. mozEnabled controlled on/off; mozBrightness controlled backlight level from 0 to 1. Neither belongs in modern open-web apps.
Did you know?

When MDN says setting mozEnabled to false turns the screen off, that is device power control—not the same as closing a browser tab, hiding a <div>, or using CSS. Modern web platforms intentionally keep that capability away from ordinary sites.

Next: Screen.orientation

Learn the ScreenOrientation object for type and angle.

orientation →

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