Controlling DNS Prefetchingin This article
- Background
- Configuring Prefetching in the browser
- Controlling prefetching from Content
- Turning on and off prefetching
- Forcing lookup of specific hostnames
- See Also
As of version 3.5, Firefox supports DNS prefetching. This was a feature by which Firefox proactively performs domain name resolution on both links that the user could choose to f Ollow as well as URLs for items referenced by the document, including images, CSS, JavaScript, and so forth.
This prefetching was performed in the background, so, the DNS was likely to already has been resolved by the time the R eferenced items are actually needed. This reduces latency if, for example, the user actually clicks a link.
Background
DNS Requests is very small in terms of bandwidth, but latency can is quite high, especially on mobile networks. by speculatively prefetching DNS results, latency if, for example, the user clicks a link can is reduced significantly ( On the order of a second, in some cases).
The implementation of this prefetching in Firefox allows domain name resolution to occur in parallel with (instead of in S Erial with) The fetching of actual page content. By doing this, the high latency domain name resolution process doesn ' t cause delays during the process of fetching content .
Page load times--especially on mobile networks--can is measurably improved this. If the domain names for images can is resolved in advance of the images being requested, pages that load a number of image s can see a load time improvement of 5% or more.
Configuring Prefetching in the browser
In the general, you don ' t need to do anything to manage prefetching. However, the user may wish to disable prefetching. This can is done by setting the network.dns.disablePrefetch preference to true .
Also, by default, prefetching of embedded link hostnames are not performed on documents loaded over HTTPS. This can is changed by setting the network.dns.disablePrefetchFromHTTPS preference to false .
Controlling prefetching from Content
Content providers has some control over the prefetching process as well. This is compatible and how Google Chrome handles DNS prefetching control.
Turning on and off prefetching
First of all, a-server can opt out of DNS prefetching by serving content with x-dns-prefetch-control: the HTTP header set to " off ".
This can also is done from individual documents, using the- http-equiv the attribute on <meta> the element, like this:
<meta http-equiv="x-dns-prefetch-control" content="off">
You can reverse this setting by setting to content " on ".
Forcing lookup of specific hostnames
The content provider can force the lookup of specific hostnames without providing specific anchors using this hostname by Using the rel attribute on the <link> element with a link type of dns-prefetch :
<link rel="dns-prefetch" href="http://www.spreadfirefox.com/">
In this example, Firefox would pre-resolve the domain name "www.spreadfirefox.com".
Similarly, the link element can be used to resolve hostnames without providing a complete URL, by preceding the hostname W ITH slashes:
<link rel="dns-prefetch" href="//www.spreadfirefox.com">
Forced prefetching of hostnames might be useful, for example, on the home page of a site to force pre-resolution of domain Names that is referenced frequently throughout the site even though they ' re not used on the home page itself. This would improve overall site performance even though the performance of the home page may is not affected.
See Also
- DNS prefetching for Firefox (blog post)
controlling DNS prefetching