JavaScript Screen mozBrightness Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Property

Definition

Screen.mozBrightness was a Mozilla property for the screen backlight level as a double from 0 (very dim) to 1 (full brightness) (MDN). Access was window.screen.mozBrightness.

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

Syntax

Use screen.mozBrightness. Start with this line.

JavaScript
window.screen.mozBrightness
CallWhat it does
window.screen.mozBrightnessPrimary signature.

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

Library declarations
JavaScript
window.screen.mozBrightness

Parameters

ParameterDescription
mozBrightnessOptional. Backlight level 0–1

Return Value

Return ValueDescription
*The current value of screen.mozBrightness.

JavaScript Examples

Example 1 — Feature-Detect mozBrightness

Check whether the legacy 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");
}
Try It Yourself

How It Works

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

Example 2 — Safe Read (When Present)

Read the 0–1 level only after detection.

JavaScript
function readMozBrightness() {
  if (!("mozBrightness" in window.screen)) {
    return { supported: false, value: null };
  }
  return {
    supported: true,
    value: Number(window.screen.mozBrightness)
  };
}

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

How It Works

  1. Wrap detection. A small helper returns a clear object either way.
  2. Unsupported → null. Avoids undefined surprises in callers.
  3. Supported → number. Number(...) normalizes the double.
  4. Read-only demo. We intentionally do not write — writing is legacy-only and unreliable.

Example 3 — Modern Advice Message

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

JavaScript
if ("mozBrightness" in window.screen) {
  console.log("Legacy API present — do not use in new apps");
} else {
  console.log("No standard backlight API — leave brightness to the OS");
}
Try It Yourself

How It Works

  1. Branch on support. Presence means a legacy engine, not a green light for new features.
  2. Legacy message. Even if present, MDN says avoid it in new projects.
  3. Modern message. Missing API is expected — use OS brightness controls.
  4. Takeaway. Web pages should not control device backlight.

Browser Support

Screen.mozBrightness is Deprecated and Non-standard. It was a Mozilla-oriented API (historically behind prefs / device builds). Do not rely on it in production.

✓ Deprecated · Non-standard

Screen.mozBrightness

Legacy backlight double 0–1 — 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
mozBrightness Avoid

Bottom line: Feature-detect only for literacy or migration. There is no standard webpage API for device backlight — leave brightness to the user and OS.

Frequently Asked Questions

On engines that still expose it, a number from 0 (very dim) to 1 (full brightness) for 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 Mozilla-specific and missing or removed/disabled in modern browsers. Always feature-detect; expect it to be absent.
There is no standard web API for controlling device backlight from a normal webpage. Leave brightness to the OS/user. For on-page look only, CSS filters affect the page—not hardware backlight.
Useful for reading legacy Firefox / Firefox OS code and interviews. Feature-detect, never require it, and do not control brightness from the open web.

Next: mozEnabled

Learn the related deprecated Mozilla property that toggled the screen on or off.

mozEnabled 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