OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

preconnect vs dns-prefetch resource hints

  • Thread starter Thread starter Robin Drexler
  • Start date Start date
R

Robin Drexler

Guest
https://www.w3.org/TR/resource-hints/

If I understand correctly, both are used to initiate an early connection to load resources faster at a later time.

preconnect is just doing "more".

Apart from a better browser support, is there any reason to use dns-prefetch over preconnect? I've also seen websites using both rel at the same link tag in order to use preconnect if possible and fall back to dns-prefetch if not.

Code:
<head>
  <link
    rel="dns-prefetch preconnect"
    href="https://fonts.gstatic.com"
    crossorigin
  >
</head>
<p><a href="https://www.w3.org/TR/resource-hints/" rel="noreferrer">https://www.w3.org/TR/resource-hints/</a></p>

<p>If I understand correctly, both are used to initiate an early connection to load resources faster at a later time.</p>

<p>preconnect is just doing "more".</p>

<p>Apart from a better browser support, is there any reason to use dns-prefetch over preconnect? I've also seen websites using both rel at the same link tag in order to use preconnect if possible and fall back to dns-prefetch if not.</p>

<pre><code><head>
<link
rel="dns-prefetch preconnect"
href="https://fonts.gstatic.com"
crossorigin
>
</head>
</code></pre>
Continue reading...
 

Latest posts

Top