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
Fundamentals
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.
Concept
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.
Foundation
📝 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.
Compare
🔄 mozEnabled vs mozBrightness
Property
Meaning (legacy)
screen.mozEnabled
Boolean on/off for the device screen
screen.mozBrightness
Number 0…1 for backlight intensity
Both
Deprecated · 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.
Today
🎯 What To Do Instead
Goal
Modern approach
Save power / sleep
OS power button, sleep timeout, user settings
Hide page content
UI overlays, route changes, CSS visibility—not hardware off
Legacy Firefox OS code
Remove mozEnabled; do not port to the open web
Screen diagnostics
Standard screen.height, availHeight, etc.
Safety
🛡️ 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());
Cheat Sheet
⚡ Quick Reference
Goal
Code / note
Feature-detect
"mozEnabled" in screen
Read (legacy)
screen.mozEnabled
Turn off (legacy)
screen.mozEnabled = false — do not use
Related legacy
screen.mozBrightness
MDN status
Deprecated · Non-standard
New code
Do not use
Snapshot
🔍 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
Hands-On
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");
}
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());
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);
}
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.
LegacyAvoid in new apps
Mozilla FirefoxLegacy / typically removed or unavailable in modern builds
Avoid
Google ChromeNot supported — feature-detect
Unavailable
Microsoft EdgeNot supported — feature-detect
Unavailable
Apple SafariNot supported — feature-detect
Unavailable
OperaNot supported — feature-detect
Unavailable
Internet ExplorerNo mozEnabled support
Unavailable
mozEnabledDeprecated
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.
Wrap Up
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.
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
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about mozEnabled
Deprecated non-standard screen on/off flag.
5
Core concepts
💡01
Boolean
screen on/off
Value
⚠️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.