예배 규칙서 찾다
Guides Access control CORS Authentication Browser detection using the user agent Caching Caching FAQ Compression Conditional requests Connection management in HTTP 1.x Content negotiation Content negotiation: List of default Accept values Cookies CSP Messages Overview Protocol upgrade mechanism Proxy servers and tunneling Proxy servers and tunneling: Proxy Auto-Configuration (PAC) file Public Key Pinning Range requests Redirections Resources and specifications Resources and URIs Response codes Server-Side Access Control Session Guides: Basics Basics of HTTP Choosing between www and non-www URLs Data URIs Evolution of HTTP Identifying resources on the Web MIME Types MIME types: Complete list of MIME types CSP Content-Security-Policy Content-Security-Policy-Report-Only CSP: base-uri CSP: block-all-mixed-content CSP: child-src CSP: connect-src CSP: default-src CSP: font-src CSP: form-action CSP: frame-ancestors CSP: frame-src CSP: img-src CSP: manifest-src CSP: media-src CSP: object-src CSP: plugin-types CSP: referrer CSP: report-uri CSP: require-sri-for CSP: sandbox CSP: script-src CSP: style-src CSP: upgrade-insecure-requests CSP: worker-src Headers Accept Accept-Charset Accept-Encoding Accept-Language Accept-Ranges Access-Control-Allow-Credentials Access-Control-Allow-Headers Access-Control-Allow-Methods Access-Control-Allow-Origin Access-Control-Expose-Headers Access-Control-Max-Age Access-Control-Request-Headers Access-Control-Request-Method Age Allow Authorization Cache-Control Connection Content-Disposition Content-Encoding Content-Language Content-Length Content-Location Content-Range Content-Type Cookie Cookie2 Date DNT ETag Expect Expires Forwarded From Headers Host If-Match If-Modified-Since If-None-Match If-Range If-Unmodified-Since Keep-Alive Large-Allocation Last-Modified Location Origin Pragma Proxy-Authenticate Proxy-Authorization Public-Key-Pins Public-Key-Pins-Report-Only Range Referer Referrer-Policy Retry-After Server Set-Cookie Set-Cookie2 SourceMap Strict-Transport-Security TE Tk Trailer Transfer-Encoding Upgrade-Insecure-Requests User-Agent User-Agent: Firefox Vary Via Warning WWW-Authenticate X-Content-Type-Options X-DNS-Prefetch-Control X-Forwarded-For X-Forwarded-Host X-Forwarded-Proto X-Frame-Options X-XSS-Protection Methods CONNECT DELETE GET HEAD Methods OPTIONS PATCH POST PUT Status 100 Continue 101 Switching Protocols 200 OK 201 Created 202 Accepted 203 Non-Authoritative Information 204 No Content 205 Reset Content 206 Partial Content 300 Multiple Choices 301 Moved Permanently 302 Found 303 See Other 304 Not Modified 307 Temporary Redirect 308 Permanent Redirect 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 405 Method Not Allowed 406 Not Acceptable 407 Proxy Authentication Required 408 Request Timeout 409 Conflict 410 Gone 411 Length Required 412 Precondition Failed 413 Payload Too Large 414 URI Too Long 415 Unsupported Media Type 416 Range Not Satisfiable 417 Expectation Failed 426 Upgrade Required 428 Precondition Required 429 Too Many Requests 431 Request Header Fields Too Large 451 Unavailable For Legal Reasons 500 Internal Server Error 501 Not Implemented 502 Bad Gateway 503 Service Unavailable 504 Gateway Timeout 505 HTTP Version Not Supported 511 Network Authentication Required Status
문자

X-DNS-Prefetch-ControlHTTP 响应头控制 DNS 预取功能通过对用户可以选择跟随,以及通过在文档,包括图片,CSS,JavaScript 和等参考项的 URL 都链接浏览器主动进行域名解析。

该预取在后台执行,以便在需要引用项目时 DNS 可能已经解决。这可以减少用户点击链接时的等待时间。

Header type

Response header

Forbidden header name

no

句法

X-DNS-Prefetch-Control: on
X-DNS-Prefetch-Control: off

指令

onEnables DNS 预取。这是浏览器所做的,如果它们支持该功能的话,那么这个标题不是 presentoffDisables 的 DNS 预取。如果您不控制页面上的链接,或者不知道您不希望将信息泄漏到这些域,这很有用。

描述

DNS 请求在带宽方面非常小,但延迟非常高,特别是在移动网络上。通过推测性地预取 DNS 结果,可以在某些时候显着降低延迟,例如当用户点击链接时。在某些情况下,延迟可能会缩短一秒。

在一些浏览器中实现这种预取允许域名解析与实际页面内容的获取并行(而不是与其串行)发生。通过这样做,高延迟域名解析过程在获取内容时不会造成任何延迟。

页面加载时间 - 尤其是在移动网络上 - 可以通过这种方式进行可测量的改进。如果可以在请求的图像之前解析图像的域名,那么载入很多图像的页面在加载图像时可以看到 5% 或更多的改进。

在浏览器中配置预取

一般来说,您不需要执行任何操作来管理预取。但是,用户可能希望禁用预取。在 Firefox 上,这可以通过设置network.dns.disablePrefetch首选项来完成true

另外,默认情况下,不会对通过 HTTPS 加载的文档执行预取嵌入式链接主机名。在 Firefox 上,可以通过设置network.dns.disablePrefetchFromHTTPS首选项来更改false

例子

打开和关闭预取

您可以X-DNS-Prefetch-Control使用元素http-equiv上的属性来发送头部服务器端或单个文档<meta>,如下所示:

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

您可以通过设置content为“ on” 来反转此设置。

强制查找特定主机名

您可以强制特定的主机名的查找,而不提供使用主机名通过使用特定的锚rel上的属性<link>与元素链接类型的dns-prefetch

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

在这个例子中,域名 “ www.spreadfirefox.com ” 将被预先解决。

同样,链接元素可用于解析主机名而不提供完整的 URL,但只能通过在主机名前面加两个斜线来解析:

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

强制预取主机名可能很有用,例如,在网站的主页上强制预先解析在整个网站中经常被引用的域名,即使它们没有在主页上使用。即使主页的性能可能不会受到影响,这也会改善网站的整体性能。

이전 기사: 다음 기사: