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

[网络] 11. 请简述如何在 HTML 中开启和关闭 DNS 预读取? #948

Open
qiilee opened this issue Feb 24, 2020 · 0 comments
Open

Comments

@qiilee
Copy link
Member

qiilee commented Feb 24, 2020

答案:

DNS 预读取

概念:

浏览器主动去执行域名解析功能。

当浏览网页时,浏览器会对网页中的域名进行解析缓存,这样当单击当前网页中的连接时就无需进行 DNS 解析,减少用户等待时间,提高用户体验。

范围:

图片、CSS、JS 或 html 上的 link 等 URL。

开关和使用:

<meta http-equiv="x-dns-prefetch-control" content="off" />

<link rel="dns-prefetch" href="//www.spreadfirefox.com" />

前端优化:

减少 DNS 请求次数;

进行 DNS 预获取;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant