[Resolved] Preload Hook not working

Home Forums Support [Resolved] Preload Hook not working

Home Forums Support Preload Hook not working

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1270188
    comichouse

    To speed up loading times I want to preload a font using this GP hook (wp-head):
    <link rel="preload" href="/wp-content/plugins/elementor/assets/lib/font-awesome/webfonts/fa-solid-900.woff2" as="font" type="font/woff2" crossorigin>

    But Google PageSpeed keeps giving me this warning:
    Warnings: A preload <link> was found for [url] but this has not been used by the browser. Check if you are using the crossorigin attribute correctly.

    What am I doing wrong?

    #1270233
    David
    Staff
    Customer Support

    Hi there,

    did you change the Link attributes ? As I am not seeing the crossorigin or the type attribute

    #1270245
    comichouse

    Hey David,

    Yes, you are right. In the html the attibutes are missing. Still, in the webhook the code is correct and complete (as far as I know). Here’s what it looks like in WP: https://imgshare.io/image/zV5qe

    #1270257
    David
    Staff
    Customer Support

    Looks like WP is stripping it – What if you include the full attribute ie. crossorigin="anonymous" ?

    #1270265
    comichouse

    Yep! WP is not stripping that one. Nice! Still the same error message keeps popping up though. As long as the browser is not using the preload rule, there is no benefit.

    #1270287
    comichouse

    Hold up! I just tried PageSpeed again, and the message is gone. So I guess it’s working now, although I don’t see any speed increase. On the contrary, it takes longer. But it seems this error is solved, so thanks for helping out!

    #1270294
    David
    Staff
    Customer Support

    I am no longer seeing that error in the console or in Google Pagespeed test or a lighthouse report – where are you seeing it ?

    #1270296
    David
    Staff
    Customer Support

    Looks like our replies got crossed….
    Problem you have preloading a font is that it render blocks the site being displayed. So the delay is all up front.

    I personally would suggest looking at how to get rid of Font Awesome icons if you can.

    #1270388
    comichouse

    Okay. I’ll look into that. Thanks again!

    #1270457
    David
    Staff
    Customer Support

    You’re welcome

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.