Home › Forums › Support › Change dns-prefetch to preconnect › Reply To: Change dns-prefetch to preconnect
This is before (with no prefetch/preconnect)…
https://www.webpagetest.org/result/160916_CM_2GCG/1/details/
http://i.imgur.com/70vdPAL.png
http://i.imgur.com/fTfIn3e.png
and this is after…
https://www.webpagetest.org/result/160916_HG_2GEH/1/details/
http://i.imgur.com/noxr7jI.png
http://i.imgur.com/4GBreEh.png
Seems that some numbers are better, some are worse. However, I do see that it loaded the DNS for fonts.gstatic.com at the same time as the request to fonts.googleapis.com.
EDIT:
To compare, here is the results running the following lines in wp_head of Hooks.
<link rel='preconnect' href='https://fonts.googleapis.com' crossorigin>
<link rel='preconnect' href='https://fonts.gstatic.com' crossorigin>
<link rel='preconnect' href='https://fonts.googleapis.com/css?family=Oxygen:300,regular,700' crossorigin>
https://www.webpagetest.org/result/160916_9D_2H58/1/details/
http://i.imgur.com/f7FZuDG.png
http://i.imgur.com/HLPEzHW.png
Interestingly, you can see using the preconnect in Hooks, that it loads the resources from fonts.gstatic.com and does the SSL connection right there, as opposed to waiting when using the function you provided.