最佳做法审核
这些检查突出了可以改善您的 Web 应用整体代码健康状况的机会。
- 常见的最佳做法 #
- 页面缺少 HTML 文档类型,因此触发了 Quirks 模式 了解如何确保页面不会触发旧版浏览器中的 Quirks 模式。
- 将浏览器错误记录到控制台 了解如何识别和解决浏览器错误。
- 显示纵横比不正确的图像 了解如何以正确的纵横比显示响应式图像。
- 页面缺少 HTML 文档类型,因此触发了 Quirks 模式
- 使您的网页变快 #
- 没有为所有资源使用 HTTP/2 了解为什么 HTTP/2 对页面加载时间很重要以及如何在服务器上启用 HTTP/2。
- 使用 document.write() 了解如何通过避免使用 document.write() 来加快页面加载速度。
- 使用被动监听器优化滚动体验 了解如何通过避免被动事件监听器来提高页面的滚动响应能力。
- 没有为所有资源使用 HTTP/2
- 使您的网页安全 #
- 指向跨源目的地的链接不安全 了解如何安全地链接到另一台主机上的资源。
- 包括具有已知安全漏洞的前端 JavaScript 库 了解如何通过替换具有已知漏洞的 JavaScript 库使您的页面更安全。
- Ensure CSP is effective against XSS attacks Learn about preventing cross-site scripting (XSS) attacks with a strict Content Security Policy (CSP).
- 指向跨源目的地的链接不安全
- 创造良好的用户体验 #
- Requests the geolocation permission on page load Learn how to responsibly request geolocation permission in a way that provides good user experience.
- Requests the notification permission on page load Learn how to responsibly request notification permission in a way that provides good user experience.
- Requests the geolocation permission on page load
- 避免已弃用的技术 #
- Uses Application Cache Learn how to migrate your web page from the deprecated Application Cache to the Cache API.
- Uses deprecated APIs Learn how to remove and replace deprecated APIs from your web page.
- Uses Application Cache
- 诊断性审核 #
- Detected JavaScript libraries Learn about Lighthouse's diagnostic "Detected JavaScript libraries" audit.
- Detected JavaScript libraries