• Resolved omahoung

    (@omahoung)


    Hello,

    I have a warning in Google PageSpeed insights when testing different websites. All these websites use SG Optimizer. The warning shows only when in the “Frontend optimization” options I turn on “Web fonts optimization”. The warning is:

    Warnings: A <link rel=preconnect> was found for "https://fonts.googleapis.com" but was not used by the browser. Only use preconnect for important origins that the page will certainly request.

    About the settings I use in SG Optimizer, basically all is switched on (preload, dns prefetch, web fonts optimization…).

    Am I doing something wrong? Or is there another issue?

    I have another question about the DNS prefetch for fonts. If all the fonts are preloaded, is it necessary or unnecessary to prefetch fonts.googleapis.com?

    Thanks for taking the time to look at this problem.

    • This topic was modified 2 years, 10 months ago by omahoung.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Vladimir Trandev

    (@vtrandev)

    Hello @omahoung,

    With the Web Fonts Optimization, we are changing the default way to load Google fonts in order to save HTTP requests. When you enable it, we add the so-called “preconnect” link to fonts.gstatic.com so we will do the DNS lookup, TLS negotiation, and the TCP handshake.

    As for your other question, once the option is enabled we automatically preload Google fonts, so you do not have to apply anything else. We make a request to Google, get the generated CSS which actually includes the fonts and then save it locally. I can see that the feature is working properly for your application and the generated .css file is currently available in your uploads/siteground-optimizer-assets/fonts folder.

    Regards,
    Vladimir

    Thread Starter omahoung

    (@omahoung)

    Thanks for the fast answer.
    All my fonts are on https://fonts.gstatic.com (I am testing the home page) but the plugin add a preconnect to https://fonts.googleapis.com (that’s the reason of the PageSpeed Insights warning). Is this additional preconnect necessary?

    • This reply was modified 2 years, 10 months ago by omahoung.
    Plugin Support Georgi Ganchev

    (@georgiganchev)

    Hello @omahoung,

    As Vladimir explained with the Web Fonts Optimization we’re changing the default way we load Google fonts. A preconnect link for Google’s font repository is added to your head tag. This informs the browser that your page intends to establish a connection to another origin, and that you’d like the process to start as soon as possible. In addition, all other local fonts are also preloaded so browsers can cache and render them faster.

    The fonts.googleapis.com appears to be in use and you can expect the same by disabling the Web font optimizations and flushing the cache of your application. Inspecting the source code after those actions will show you the fonts without the additional enhancements that we apply. There you can verify that the geoport-body-fonts-css is using href=’//fonts.googleapis.com

    Since it is included in the .css it gets automatically preconnected.

    Best regards,
    Georgi Ganchev

    Thread Starter omahoung

    (@omahoung)

    Hi,
    Yes I can now see in the not cached version of the site that geoport-body-fonts-css uses href=//fonts.googleapis.com. But I actually still can’t understand very well why the cache version needs a prefetch to googleapis without these fonts being actually loaded from that source. Anyway, if you say it is normal then it is fine for me.
    Thanks for the answers.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Preconnect issue’ is closed to new replies.