Skip to content
Related Articles
Open in App
Not now

Related Articles

HTTP headers | X-DNS-Prefetch-Control

Improve Article
Save Article
  • Last Updated : 30 Dec, 2019
Improve Article
Save Article

The X-DNS-Prefetch-Control is an HTTP response type header that informs the browser whether DNS prefetch to be executed or not. Turning it on may not work as many browsers may not support it in all the situations. Turning it off should disable in all supported browsers. Most of the browsers will ignore this header as they don’t do DNS prefetching.

File objects like style sheets, images, JavaScript, etc are pre-fetched in the background. Pre-fetching is done in the background as it is possible that the DNS will be handled by the time the specified items are needed or the user clicks a URL, this reduces latency.


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

Directives: This header accepts two directives as mentioned above and described below:

  • on: This directive enables pre-fetching of the DNS. This is what browsers do when this header is not available, if they support the function.
  • off: This directive disables pre-fetching of DNS. This is useful if you don’t monitor the pages reference, or if you know that you don’t want to leak information to those websites.


  • Specific hostnames force lookup: By using the rel attribute on the <link> component with a link type of DNS-Prefetch, you can force the lookup of certain hostnames without providing specific anchors. In this example, the domain name “” will be pre-resolved.
    <link rel="dns-prefetch" href="">

    Likewise, the link component is used to resolve hostnames without having a full URL, but only by adding dual slashes before the hostname:

    <link rel="dns-prefetch" href="//">
  • Turning on and off prefetching: You can also use the HTTP-Equiv parameter on the component to send the X-DNS-Prefetch-Control headers server-side or from individual files. Forced prefetching of hostnames could be helpful, for instance, on a site’s homepage to compel pre-resolution of domain names often cited throughout the site even though they are not used on the home page itself.
    <meta http-equiv="x-dns-prefetch-control" content="off">
    <meta http-equiv="x-dns-prefetch-control" content="on">

Note: DNS requests are very small in terms of bandwidth, but latency can be very high for mobile networks.

Supported Browsers: The browsers supported by X-DNS-Prefetch-Control header are listed below:

  • Google Chrome
  • Firefox
  • Opera
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!