scripting
CSS
media feature
can be used to test whether scripting (such as JavaScript) is available.
scripting
feature is specified as a keyword value chosen from the list below.
none
Scripting is completely unavailable on the current document.
initial-only
Scripting is enabled during the initial page load, but not afterwards.
enabled
Scripting is supported and active on the current document.
<p class="script-none">You do not have scripting available. :-(</p> <p class="script-initial-only">Your scripting is only enabled during the initial page load. Weird.</p> <p class="script-enabled">You have scripting enabled! :-)</p>
p {
color: lightgray;
}
@media (scripting: none) {
.script-none {
color: red;
}
}
@media (scripting: initial-only) {
.script-initial-only {
color: red;
}
}
@media (scripting: enabled) {
.script-enabled {
color: red;
}
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
Media Queries Level 5
The definition of 'scripting' in that specification. |
编者草案 | 初始定义 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
scripting
media feature
|
Chrome
不支持
No
注意事项
|
Edge
不支持
No
注意事项
|
Firefox
不支持
No
注意事项
|
IE 不支持 No | Opera 不支持 No | Safari 不支持 No |
WebView Android
不支持
No
注意事项
|
Chrome Android
不支持
No
注意事项
|
Firefox Android
不支持
No
注意事项
|
Opera Android 不支持 No | Safari iOS 不支持 No |
Samsung Internet Android
不支持
No
注意事项
|
不支持
见实现注意事项。