DNS Prefetching

Hi. I was reading the following about DNS Prefetching and saw this excerpt:

https://www.chromium.org/developers/design-documents/dns-prefetching

“The most obvious example where DNS prefetching can help is when a user is looking at a page with many links to various domains, such as a search results page.”

So if I use the following:

function stb_dns_prefetch() {
echo ‘<meta http-equiv=”x-dns-prefetch-control” content=”on”>
<link rel=”dns-prefetch” href=”//modovis.com” />
<link rel=”dns-prefetch” href=”//fonts.googleapis.com” />
<link rel=”dns-prefetch” href=”//fonts.gstatic.com” />’;
}
add_action(‘wp_head’, ‘stb_dns_prefetch’, 0);

If a user Googles my company name, once the search results show my link in the search results, and before they even click the link, prefetching will begin with the resources I have identified in my above code?

Your code is using the wrong type of quotes and so will give numerous syntax errors.

What is the correct way? I found a number of souces using that shema, so I just copied it. Im not saying its still not wrong, I just am not sure the correct way.

I suspect the issue is the editor you are using. Word Processors tend to use “smart quotes” that are NOT what applications require; or what code editors will use.

" and ’ are correct

” ‘ and ’ are invalid

1 Like

Ohh I see. Thanks!

I may very well be wrong, but that’s not how I’m reading the article.

As I read it, the manual pre-fetch will only work on the page which includes it, for domains linked from that page.

My understanding is that Google (or other search engine) would could pre-fetch the domains shown on the results page, but not any domains linked from those pages.

I read it the same way. My objective here is to get prefetch my dns and possibly add some resources on my page to be prefetched upon search. I think of we are reading that the same this might be the case. I’m working on my page loading speed .

My take is that prefetch is good for when “after the current page loads get the stuff ahead of time for the pages they might go to”

AFAIK - and with limited testing what my dev tools network shows is consistent with this - is that Google does not prefetch on the results page.

Where this could help is on your site once someone is on your site.

2 Likes

I think we’re not. Mittineague has expressed more clearly what I was trying to say.

Then we aren’t haha! Well then you both have cleared it up. Makes more sense. Thanks!

Hey

It will prefetch only DNS requests so far I understand that but will not preload your domains before click occures.

If I’m wrong please tell me

DNS prefetching is telling the browser to start resolving the IP address for the host name mentioned while the page keeps on loading so once it hits the resource you are linking to on that domain, like a font, or script, or stylesheet, it will already have resolved the DNS for that domain and can connect instantly because it has already resolved the IP.

It has nothing to do with google and/or ranking whatsoever.

See https://www.w3.org/TR/resource-hints/#dns-prefetch

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.