htmlcssgoogle-chromesvgpreload

How to preload an SVG image properly?


I'm trying to preload an SVG logo on my blog, but Chrome keeps giving me a bunch of warnings and I don't seem to be able to fix them.

Logo: https://keestalkstech.com/wp-content/uploads/2019/05/ktt-logo.svg
Preload link: <link rel="preload" href="https://keestalkstech.com/wp-content/uploads/2019/05/ktt-logo.svg" as="image" type="image/svg+xml" crossorigin="anonymous" />

I'm getting the following warnings in Chrome:

A preload for 'https://keestalkstech.com/wp-content/uploads/2019/05/ktt-logo.svg' is found, but is not used because the request credentials mode does not match. Consider taking a look at crossorigin attribute.

And:

The resource https://keestalkstech.com/wp-content/uploads/2019/05/ktt-logo.svg was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate as value and it is preloaded intentionally.

Any pointers?


Solution

  • Looks like removing the crossorigin attributes fixes it:

    <link rel="preload" 
          href="https://keestalkstech.com/wp-content/uploads/2019/05/ktt-logo.svg"
          as="image"
          type="image/svg+xml" />