跳到正文
Skillpedia
网站与界面(前端)75k · #2954

noscript-tag

它能做什么

这个技能检查当 JavaScript 被关闭或加载失败时,页面是否仍然显示关键内容,并提供有用的替代方案。它面向希望网站对所有人都可用的网站构建者。

适用场景

  • ✓你请智能体检查关闭了 JavaScript 的用户会看到什么的时候。
  • ✓页面在没有 JavaScript 时是空白的,而你希望核心内容出现在初始 HTML 中的时候。
  • ✓你添加了依赖 JavaScript 的功能,需要带有有用替代方案的 noscript 提示的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/noscript-tag/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/noscript-tag/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“如果有人关闭了 JavaScript,我的页面就是空白的。请帮我添加备用内容,让主要信息仍然能显示吗?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会检查服务器发送的首个 HTML 中是否包含重要内容,而不只是脚本运行之后才出现。然后它会为需要 JavaScript 的功能添加 noscript 代码块,提供真实的替代内容或链接。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Provide noscript fallback content

Users with JavaScript disabled, blocked by corporate firewalls, or with failed script loads see blank pages without proper noscript fallbacks.

Quick Reference

  • Add <noscript> with helpful message for JS-dependent features
  • Provide alternative content, not just 'Enable JavaScript'
  • Use for critical features: analytics fallback, lazy-loaded images
  • Consider progressive enhancement: content works without JS
  • Important content should be present in the initial HTML, not fetched only after hydration

Check

Verify that this page provides appropriate noscript fallbacks for users with JavaScript disabled or unavailable, ensuring core functionality remains accessible. Confirm important content exists in the initial HTML and is not blocked on hydration.

Fix

Add noscript elements with alternative content or functionality for critical features that depend on JavaScript. Replace UA-sniffed behavior with feature detection and make sure the server-rendered HTML already contains the important content and pagination paths.

Explain

Explain why noscript fallbacks are important for accessibility, progressive enhancement, and ensuring your site works for all users regardless of their JavaScript support. Explain why feature detection is safer than UA sniffing and why hydration mismatches can break progressive enhancement.

Code Review

Review templates, server-rendered HTML, and shared components that output markup related to Provide noscript fallback content. Flag exact elements, attributes, and routes where the rendered HTML violates the rule.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/html/noscript-tag

常见问题

noscript 提示只写“请启用 JavaScript”够吗?

不够。这个技能说,应该提供替代的内容或功能,而不仅仅是请用户开启 JavaScript。

为什么服务器端渲染的 HTML 很重要?

这意味着即使脚本还未加载,主要内容也是可见的,这对脚本被阻止的用户和搜索引擎都有帮助。

我应该使用功能检测吗?

应该。这个技能推荐功能检测,而不是浏览器识别,因为它更可靠。

详情

作者的原始描述

Use when reviewing templates, rendered HTML, or shared components related to Provide noscript fallback content. Validate the final browser-facing markup, not just the source framework abstraction.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2954
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能