<noscript>:无脚本元素

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

<noscript> HTML 元素定义了在页面上的脚本类型不支持或浏览器当前关闭脚本时插入的 HTML 部分。

属性

这个元素只包含全局属性

示例

html
<noscript>
  <!-- 外部文件的锚链接 -->
  <a href="https://www.mozilla.org/">外部链接</a>
</noscript>
<p>摇滚!</p>

启用脚本后的结果

摇滚!

禁用脚本后的结果

外部链接

摇滚!

技术概要

内容分类 元数据内容流式内容短语内容
允许的内容 当脚本被禁用并且是 <head> 元素的后代时:按任意顺序,零个或多个 <link> 元素、零个或多个 <style> 元素,以及零个或多个 <meta> 元素。
当脚本被禁用且不是 <head> 元素的后代时:任何透明内容,但其后代中不得包含 <noscript> 元素。
否则:流内容或短语内容。
标签省略 不允许,开始标签和结束标签都不能省略。
允许的父元素 任何接受短语内容的元素。如果没有祖先 <noscript> 元素,或者在 <head> 元素中(但仅限于 HTML 文档),同样如果没有任何祖先 <noscript> 元素。
隐含的 ARIA 角色 没有对应的角色
允许的 ARIA 角色 没有允许的 role
DOM 接口 HTMLElement

规范

Specification
HTML
# the-noscript-element

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
noscript

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support