Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zh-cn: update the content of the Why use dns-prefetch? section #16802

Merged
merged 2 commits into from
Nov 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions files/zh-cn/web/performance/dns-prefetch/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ slug: Web/Performance/dns-prefetch

## 为什么要使用 dns-prefetch?

当浏览器从(第三方)服务器请求资源时,必须先将该[跨源](/zh-CN/docs/Web/HTTP/CORS)域名解析为 IP 地址,然后浏览器才能发出请求。此过程称为 DNS 解析。DNS 缓存可以帮助减少此延迟, DNS 解析可以导致请求增加明显的延迟。对于打开了与许多第三方的连接的网站,此延迟可能会大大降低加载性能。
当浏览器从(第三方)服务器请求资源时,必须先将该[跨源](/zh-CN/docs/Web/HTTP/CORS)域名解析为 IP 地址,然后浏览器才能发出请求。此过程称为 DNS 解析。虽然 DNS 缓存可以帮助减少此延迟, DNS 解析可能会给请求增加明显的延迟。对于打开了与许多第三方的连接的网站,此延迟可能会大大降低加载性能。

`dns-prefetch` 可帮助开发人员掩盖 DNS 解析延迟。[HTML `<link>` 元素](/zh-CN/docs/Web/HTML/Element/link)通过 `dns-prefetch` 的 [`rel` 属性](/zh-CN/docs/Web/HTML/Attributes/rel)值提供此功能。然后在 [href 属性](/zh-CN/docs/Web/HTML/Attributes)中指明要[跨源](/zh-CN/docs/Web/HTTP/CORS)的域名:
`dns-prefetch` 可帮助开发人员掩盖 DNS 解析延迟。[HTML `<link>` 元素](/zh-CN/docs/Web/HTML/Element/link)通过设置 [`rel` 属性](/zh-CN/docs/Web/HTML/Attributes/rel)值为 `dns-prefetch` 提供此功能。然后在 [href 属性](/zh-CN/docs/Web/HTML/Attributes)中指明要[跨源](/zh-CN/docs/Web/HTTP/CORS)的域名:

## 语法

Expand Down