JavaScript Screen mozEnabled Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Property

Definition

Screen.mozEnabled was a Mozilla Boolean that controlled the device screen. Setting it to false turned the screen off (MDN). Access was window.screen.mozEnabled.

Read the notes below before you rely on this property. Prefer feature detection when support is limited.

Syntax

Use screen.mozEnabled. Start with this line.

JavaScript
window.screen.mozEnabled
CallWhat it does
window.screen.mozEnabledPrimary signature.

Built into the browser. Read screen.mozEnabled on window.screen — no import required.

Library declarations
JavaScript
window.screen.mozEnabled

Parameters

ParameterDescription
mozEnabledOptional. Boolean — screen on/off control

Return Value

Return ValueDescription
*The current value of screen.mozEnabled.

JavaScript Examples

Example 1 — Feature-Detect mozEnabled

Check whether the legacy 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

  1. Use in. "mozEnabled" in window.screen is the safe detect.
  2. Legacy path. If present, log that it is legacy and its type ("boolean").
  3. Modern path. Most browsers hit the else branch.
  4. Never assume. Reading without a check is how old code breaks.

Example 2 — Safe Read (When Present)

Read the boolean only after detection — never assign false.

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

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

How It Works

  1. Wrap detection. A small helper returns a clear object either way.
  2. Unsupported → null. Avoids treating undefined as “screen off.”
  3. Supported → boolean. Boolean(...) normalizes the value.
  4. Read-only demo. We never write false — that was the dangerous legacy path.

Example 3 — Modern Advice Message

Teach the correct open-web stance when the API is missing.

JavaScript
if ("mozEnabled" in window.screen) {
  console.log("Legacy API present — do not turn the screen off");
} else {
  console.log("No standard screen-power API — leave sleep to the OS");
}
Try It Yourself

How It Works

  1. Branch on support. Presence means a legacy engine, not permission to power off.
  2. Legacy message. Even if present, MDN says avoid it in new projects.
  3. Modern message. Missing API is expected — OS handles sleep/power.
  4. Takeaway. Web pages must not control device screen power.

Browser Support

Screen.mozEnabled is Deprecated and Non-standard. It was a Mozilla-oriented API. Do not rely on it in production.

✓ Deprecated · Non-standard

Screen.mozEnabled

Legacy boolean for screen power — not standardized and not for new websites.

Legacy Avoid in new code
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
mozEnabled Avoid

Bottom line: Feature-detect only for literacy or migration. There is no standard webpage API to turn the physical screen off — leave power to the user and OS.

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 Mozilla-specific and missing or removed in modern browsers. Always feature-detect; expect it to be absent.
There is no standard web API for turning the physical screen off from a normal webpage. Leave power and sleep to the OS/user.
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.

Next: orientation

Learn the modern Screen.orientation property for display orientation.

orientation 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