Webmaster guide to domain name server (DNS)

For a faster and better-performing website, you may want to implement domain name server (DNS) prefetching All major web browsers now support DNS prefetching Not to be confused with prerendering, it forces web browsers to resolve the domain names of …

For a faster and better-performing website, you may want to implement domain name server (DNS) prefetching. All major web browsers now support DNS prefetching. Not to be confused with prerendering, it forces web browsers to resolve the domain names of external links and externally linked resources immediately.

What is DNS Prefetching

What Is DNS Prefetching?

DNS prefetching is the process of proactively resolving the domain names in external links or externally linked resources. When you link to another website, the web browsers of visitors must resolve the site’s domain name. Resolution involves a DNS lookup, meaning web browsers will convert the domain name into the Internet Protocol (IP) address. Only after resolving the domain name can web browsers load it.

Web browsers can’t resolve domain names instantly. According to YSlow, it takes about 20 to 120 milliseconds per domain name. Web browsers work by connecting to IP addresses and downloading resources from those IP addresses. They must resolve the domain names in external links and externally linked resources to identify the appropriate IP addresses.

How DNS Prefetching Works

Normally, web browsers will resolve domain names when visitors click an external link. For externally linked resources, resolution may occur automatically after a given period. DNS prefetching works by resolving domain names immediately. As soon as web browsers start loading a page, they’ll begin to resolve all of the page’s prefetched-specified domain names.

You can enable DNS prefetching for the domain name in any external link or externally linked resource. DNS prefetching is achieved with a short Hypertext Markup Language (HTML) snippet. The snippet consists of the link element with the “dns-prefetch” value. Adding this HTML snippet to the page’s head section will force web browsers to resolve the specified domain name immediately when the page starts to load.

If your website uses Google Fonts, for instance, you may want to use DNS prefetching for fonts.googleaips.com. This is the official domain name for the Google Fonts API. Google Fonts, of course, is an externally linked resource. While it’s displayed on your website, web browsers will retrieve Google Fonts from Google’s server. To enable DNS prefetching for it, you’ll need to add the following HTML snippet to the head section of each page with Google Fonts.

<link rel=”dns-prefetch” href=”https://fonts.googleapis.com”>

DNS prefetching is often used for the following types of externally linked resources.

  • Web fonts
  • Content delivery network (CDN) resources
  • Social media sharing buttons
  • YouTube videos
  • Video videos
  • Google Analytics
  • Google Maps
  • Gravatars
  • Advertising networks

DNS Prefetching vs Prerendering: What’s the Difference?

There’s also prerendering. Prerendering isn’t the same as DNS prefetching. Prerendering is the process of rendering a linked page before visitors click or otherwise try to access it. If most visitors access your website’s product catalog page, you may want to enable prerendering for the product catalog page. Web browsers will download and save a complete copy of the product catalog page before visitors even access it.

Prefetching doesn’t involve any file downloads. It only involves a DNS lookup, during which web browsers will resolve domain names to IP addresses.

The Benefits of DNS Prefetching

With DNS prefetching, visitors won’t have to wait for DNS resolutions to occur. Their web browsers will begin to resolve the prefect-specified domain names immediately.

The HTML snippets for DNS prefetching are placed in the head section. Therefore, web browsers will read them before the main content, which is placed in the body section. As soon as a page starts to load, web browsers will begin resolving all of the domain names for which you’ve enabled DNS prefetching.

DNS prefetching may increase your website’s traffic. Visitors are more likely to return if your website is fast. If it’s slow, they’ll probably have a negative experience that discourages them from coming back. DNS prefetching will speed up load times so that more visitors return to your website.

Another benefit of DNS prefetching is better search engine optimization (SEO). DNS prefetching isn’t a ranking factor. It will, however, improve your website’s speed, which is a ranking factor.

DNS Prefetching Best Practices

While you might be tempted to implement DNS prefetching for all of your website’s external links, this isn’t necessary. Web browsers can only resolve a limited number of domain names at any given time. As a result, you should typically use DNS prefetching for domain names with the most requests.

You can use Pingdom to identify domain names for DNS prefetching. Pingdom’s speed tester doesn’t just reveal how long it takes pages to load; it reveals the domain names in external links and externally linked resources. Pingdom’s speed tester even breaks down the number of requests associated with these domain names.

External links and externally linked resources trigger Hypertext Transfer Protocol (HTTP) requests. Web browsers will send requests to their domain names. Some domain names to which your website links may trigger more requests than others. You’ll probably want to enable DNS prefetching for these domain names.

After running your website through Pingdom’s speed tester at tools.pingdom.com, scroll to the “Requests by domain” section. Here you’ll find a list of domain names that trigger the most requests. You should enable DNS prefetching for the external domain names at the top of the list.

You’ll have to specify each external domain for which you want to enable DNS prefetching. Adding the HTML snippets to pages’ head sections will enable DNS prefetching for them. If you own a WordPress website, alternatively, you can install a plugin.

Several popular caching plugins have a built-in DNS prefetching feature. Caching plugins are designed to enable client-side caching. Nonetheless, many of them come with a DNS prefetching feature. WP Rocket and LiteSpeed Cache for WordPress offer DNS prefetching. Instead of adding the HTML snippets to pages, you can use one of these caching plugins. LiteSpeed Cache is included with our Elastic Hosting, Managed WordPress and Reseller Hosting. LSCache can be added as an add-on to our Managed VPS plans.

If you link to another website, web browsers will have to resolve the site’s domain name. Domain name resolutions take time. With DNS prefetching, you can tell web browsers to begin resolving domain names immediately. DNS prefetching will make your website faster so that it attracts more returning visitors and ranks higher on the search engines’ results pages.

Wordpress Hosting

Experience the difference with the fastest WordPress hosting platform.

Elastic Hosting

A flexible managed hosting solution that will grow with you and your needs grow.

Cloud Servers

Your dedicated cloud servers that are managed by us or managed by you.

Made InCanada
Made by Canadians,
for Canadians

Never worry about compliance again. Our servers are hosted directly on Canadian soil, and support is given by a 100% Canadian team.

We Start,
Where Others Stop.

If you've been burned by terrible hosting services before, we get you. We want every client to feel important and fully taken care of, and we'll spend the time it takes to solve any problem that arises.

Trusted by Clients Across All Industries

Don't take our word for it - let our happy clients do the talking. See More

Full Host did an amazing job of migrating my site seamlessly onto their server. My only regret was not switching my site over to them sooner. Now it is performing great, images are uploading way faster than ever before.

" Vancouver Sofa and Patio - Jerry Schmidt

Two thumbs up for Fullhost! Agents reply to me fairly quickly or at least let me know they received the ticket and are looking into it. Kudos to the support team as they have always given me exactly what I need without delays.

" Universal Staffing Inc. - Anthony Calvano

FullHost is an absolute pleasure to work with, and their customer service is exceptional. Whenever I have questions or need adjustments, they are there to help, quickly, efficiently, with answers and insights.

" Mooseworld Inc. Norine Leibel

With coast to coast coverage,
We help you serve the world.

Whether your audience is located in Europe, Asia, Africa, or Australia, provide them with lightening speed!

FullHost's data centers are located in Toronto and Vancouver to ensure worldwide quality and speed.

Get in Touch
We Trust Only The Best Tech to Support You

FullHost operates with the most innovative technology to bring you unparalleled levels of hosting services.