Screen.mozBrightness is a deprecated, non-standard instance property that described how bright the screen backlight was on a scale from 0 (very dim) to 1 (full brightness). Learn the scale, the write/read precision caveat, how to feature-detect safely, and why modern pages should not control hardware brightness—with five examples and try-it labs.
01
Kind
Instance property
02
Returns
Number (0–1)
03
Status
Deprecated · Non-standard
04
Access
window.screen
05
Engine
Mozilla legacy
06
Spec
None
Fundamentals
Introduction
Long ago, some Mozilla environments (including Firefox OS era APIs) exposed a way for privileged pages to read or set the screen backlight. That property was screen.mozBrightness: a floating-point number between 0 and 1.
Today it is a historical footnote. Most modern desktop and mobile browsers do not expose a webpage-controlled backlight API. This tutorial teaches the old property so you can understand legacy snippets—and avoid shipping new ones.
JavaScript
console.log(window.screen.mozBrightness);
💡
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.
Concept
Understanding the Property
MDN: mozBrightness indicates how bright the screen’s backlight is, on a scale from 0 (very dim) to 1 (full brightness). The value is a double-precision float.
Instance — on window.screen where supported.
Historically read/write — not a modern cross-browser API.
Range — conceptually 0…1.
Deprecated & Non-standard — not in any specification.
Foundation
📝 Syntax
JavaScript
// Read (legacy only)
const level = window.screen.mozBrightness;
// Write (legacy only — do not use in new apps)
// window.screen.mozBrightness = 0.75;
Value
A number from about 0 to 1. MDN notes you could read and write even when the screen was disabled, but the backlight stays off while the screen is disabled. Writing X may not round-trip to the same X when you read again—hardware has fewer brightness steps than floating-point values.
Caveat
⚠️ Write vs Read Precision
MDN’s important teaching point: if you write a value into mozBrightness, a later read may return a nearby quantized value. Think of it like setting a dimmer that only has a few notches—you ask for 0.73, the device stores something closer to 0.75.
JavaScript
// Legacy idea only — skipped when unsupported
if ("mozBrightness" in screen) {
screen.mozBrightness = 0.73;
console.log(screen.mozBrightness); // may not be exactly 0.73
}
Today
🎯 What To Do Instead
Goal
Modern approach
User comfort / eye strain
OS night light, auto-brightness, system settings
Page looks darker
CSS themes, filter / opacity on content (not hardware)
Legacy Firefox OS code
Remove mozBrightness; do not port to the open web
Screen size metrics
Standard screen.height, availHeight, etc.
🔒
Privacy & platform tip
Controlling the physical backlight from a random website would be surprising and invasive. Modern browsers intentionally keep that power with the OS and the user.
Safety
🛡️ Feature Detection Pattern
Wrap every access. Unsupported browsers should log a clear message and skip writes.
JavaScript
function getMozBrightness() {
if (!("mozBrightness" in window.screen)) {
return { supported: false, value: null };
}
return { supported: true, value: Number(window.screen.mozBrightness) };
}
console.log(getMozBrightness());
Cheat Sheet
⚡ Quick Reference
Goal
Code / note
Feature-detect
"mozBrightness" in screen
Read (legacy)
screen.mozBrightness
Scale
0 = dim … 1 = full
Round-trip
Written value may not equal later read
MDN status
Deprecated · Non-standard
New code
Do not use
Snapshot
🔍 At a Glance
Four facts about screen.mozBrightness.
Kind
property
Legacy r/w
Type
number
0 to 1
Via
window.screen
When present
Status
deprecated
Non-standard
Hands-On
Examples Gallery
Examples follow MDN Screen.mozBrightness. On modern browsers the demos print “not supported”—that is the correct teaching outcome.
📚 Getting Started
Detect support and read safely without throwing.
Example 1 — Feature-Detect mozBrightness
Check whether the property exists on screen.
JavaScript
if ("mozBrightness" in window.screen) {
console.log("mozBrightness is present (legacy)");
console.log(typeof screen.mozBrightness);
} else {
console.log("mozBrightness not supported");
}
Helpers keep demos readable and avoid treating undefined as a brightness level.
📈 Labels, Clamping & Snapshots
Explain the 0–1 scale and combine with baseline Screen metrics.
Example 3 — Percent Label for 0–1 Scale
Map a supported value to a beginner-friendly percent string.
JavaScript
function labelMozBrightness() {
if (!("mozBrightness" in screen)) {
return "unsupported (do not use in new apps)";
}
const pct = Math.round(Number(screen.mozBrightness) * 100);
return pct + "% backlight (legacy)";
}
console.log(labelMozBrightness());
Screen.mozBrightness 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.mozBrightness
Legacy 0–1 backlight brightness — 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 mozBrightness support
Unavailable
mozBrightnessDeprecated
Bottom line: Feature-detect only for legacy literacy. Never require mozBrightness. Leave hardware brightness to the OS; use standard Screen metrics for size and color depth.
Wrap Up
Conclusion
window.screen.mozBrightness was a deprecated, non-standard 0–1 backlight level for Mozilla environments. Feature-detect if you meet it in old code, expect it to be missing today, and never build new products around webpage-controlled hardware brightness.
Treat missing support as normal on modern browsers
Remove the property from any codebase you maintain
Use OS settings for real brightness changes
Prefer standard Screen size / color properties for diagnostics
❌ Don’t
Use mozBrightness in new production apps
Assume a written value round-trips exactly
Confuse CSS filter: brightness() with hardware backlight
Require backlight control for core product flows
Skip reading MDN’s Deprecated and Non-standard warnings
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about mozBrightness
Deprecated non-standard backlight float.
5
Core concepts
💡01
0 to 1
backlight scale
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 expose it, a number from 0 (very dim) to 1 (full brightness) describing the screen backlight. Access was typically window.screen.mozBrightness.
MDN marks Screen.mozBrightness as Deprecated and Non-standard. It is not Experimental. Do not use it in new code.
Historically yes—you could read and write it. MDN notes you may write X and later read a different value because most screens support fewer brightness steps than doubles between 0 and 1.
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 controlling the device backlight from a normal webpage (for privacy and platform reasons). Leave brightness to the OS/user, or use CSS filters only for on-page visuals—not hardware backlight.
Helpful for reading legacy Firefox / Firefox OS code and interviews. Feature-detect, never require it, and migrate away from brightness control in the page.
Did you know?
The moz prefix signals a Mozilla experiment or proprietary extension. Many historical moz* APIs were never standardized. When you see the prefix in old docs, assume limited support and look for a standard successor—or no web successor at all, as with backlight control.