DNS prefetch is a way to speed up web pages by decoding the DNS address in advance. The use of rel= dns-prefetch signals that the browser must resolve the DNS of a particular domain before it can be explicitly called, <Link rel="dns-prefetch" href="https://maxcdn.bootstrapcdn.com /"> is used in the form. This code basically says: I want to resolve a domain name before calling it, and the domain name is "maxcdn.bootstrapcdn.com "
Objective: The main objective of rel = dns-prefetch is to increase the loading speed of web pages when using different areas for page resources (multiple file loading areas). By effectively Deconditioning the way DNS lookup times occur, it can achieve gains in page loading speed. This process is usually called "DNS prefetching".
Its definition in the W3C: "The dns-prefixing connection relationship type is used to specify a resource that will be used to fetch the necessary resources, and the user agent needs to resolve it as early as possible." To review https://www.w3.org/TR/resource-hints/#dns-prefetch
Where is rel= "dns-prefetch" used?
It is used in the start area of an HTML document. DNS resolution is a necessary part of the loading process of a page. Like certain situations in life, DNS resolution is absolute. One of the reasons that is effective in page speed is that the files used during loading are downloaded from more than one domain. You can be sure that the DNS lookup for many domain names affects the upload speed.
This means that if your page resources are located in three fields, a minimum of three DNS lookups are performed. If you load resources from ten domains, you have to perform at least ten DNS lookups. For this reason, minimizing DNS requests is very important to increase page speed (but unfortunately, it is a detail that is often overlooked). Decommissioning DNS requests is very important in order to increase page speed (unfortunately, it is a detail that is often overlooked).
Where is DNS preprocessing useful?
Note that you have a lot of js files in the CDN zone that are used to load your page, as well as js hosted in another domain (adsense, seo tools, marketing tools, etc.) some 3 you call. suppose you have party items.
Normally, in a possible scenario like this, you don't know which items the browser will try to load first. But what you know for sure is that you will use your CDN. In this case, the DNS preloading process can give excellent results, because you are decoding DNS in advance using rel = dns-prefetch. This means that no matter what files the browser loads, the DNS will be solved in advance, so the resources will load faster. DNS prerequisites basically allow you to have more control over what your page will load by "hinting" at the browser instead of leaving the loading of your page to chance.
Where is DNS preprocessing not useful?
If all of your page resources are located in the same area where your html is stored. If the browser has accessed the HTML resource, it has already decoded the DNS address of that domain. If we are going to call all the images, scripts and css files from the same domain, it doesn't make sense to have to resolve the domain name again. In fact, it would be harmful to do so. It is generally healthier to have a scheduled page than to introduce any dns-prefetch process. Instead of bringing up DNS in advance, it's in your best interest to explore ways to reduce the domains your page is looking for. Even if this is not possible for everyone and every site, ask yourself these three questions before the DNS boot process.
1. Do I host my page resources in different areas?
Your HTML file example.com in, your CSS cdn.example.com and your pictures xxx.cdn.com if it comes from your address, in this case you are using resources from three different centers, and you may want to consider bringing them all to one center. It is associated with the domain name.
2. Are my resources called in a uniform format?
"Www.example.com " and "example.com " if you are calling one CSS file by name, you need to clean this file and ensure that all resources are called from www or non-www versions. The same applies to https-http. It is very common for us to see some resources coming over http on an https site.
3. Can I reduce the domain names I use for resources?
Be sure to check whether your pages are calling things that are not used on the loaded page. Things like icon fonts, plugins, social buttons are not yet used on every page, but they are still called up. Find out what your pages are loaded, you can use the page source viewer tool to see files that are called from different domains.