The scripting media feature tests whether client-side scripting (such as JavaScript) is available on the current document.
Use it for progressive enhancement: show JS-enhanced UI when scripting is enabled, and keep usable fallbacks when it is none.
Note Extensions may disagree
Browsers decide from user settings. Some script-blocking extensions use other techniques, so scripting may not match what you expect—keep HTML fallbacks.
Noteinitial-only is rare
initial-only means scripting runs during the initial load, then stops. Most sites only need enabled and none.
Share a muted default. Both paragraphs start light gray.
Branch on none. The no-JS line turns red only when scripting is off.
Branch on enabled. The JS line turns green when scripting is on.
One wins. Only one of those queries matches at a time in normal browsers.
Edge Cases & Pitfalls
Treat scripting as enhancement, not a hard gate.
a11y
Do not hide essential content
Critical text and navigation must work without depending on scripting: enabled.
extensions
Blockers can desync detection
Some extensions block scripts without updating the media feature. Keep HTML noscript / progressive defaults.
initial
initial-only is uncommon
Most teaching and production CSS only need enabled and none.
html
CSS is not a substitute for noscript
Use styles for presentation; use HTML for fallback content when scripts are disabled.
support
Older browsers ignore the query
If unsupported, neither branch applies—defaults must already be readable.
Compatibility
Browser Support
scripting is a browser media feature. Node.js, Deno, and Bun do not evaluate it.
✓ Baseline · Widely available
scripting
Interoperable across modern browsers since about December 2023 (Chrome/Edge 120+, Firefox 113+, Safari 17+). Internet Explorer does not support it.
93%Modern browsers
Google Chrome120+
Full
Mozilla Firefox113+
Full
Apple Safari17+
Full
Microsoft Edge120+
Full
Opera106+
Full
Samsung Internet25+
Full
Internet ExplorerNo
None
@media (scripting)Widely supported
Bottom line: Safe as progressive enhancement. Always ship usable HTML without depending on the query.
Remember
Key Takeaways
Role: detect whether scripting (JavaScript) is available.
Values:enabled, none, and rare initial-only.
Pattern: usable defaults first; enhance with enabled.
Tip: pair CSS with <noscript>; do not trust blockers alone.
One line:scripting lets CSS react to JS availability—enhance when enabled, fall back when none.
Frequently Asked Questions
It tests whether client-side scripting (such as JavaScript) is available. Use @media (scripting: enabled) or @media (scripting: none) to style enhanced vs fallback UI.
Three keywords: none (scripting unavailable), enabled (scripting active), and initial-only (scripting only during initial page load—rare).
No. noscript is HTML content for when scripting is off. scripting is a CSS media feature for styles. Use both for stronger no-JS support.
Browsers detect scripting from user settings. Some extensions block scripts differently, so the media feature may not match what you expect. Keep HTML fallbacks.
Show no-JS warnings, reveal static navigation, or hide JS-only chrome when scripting is none. Never hide essential content behind the query alone.
No. It is a CSS media feature evaluated by the browser, not a Node.js or server runtime feature.