My web site has just a few .PNG photos animated on the very begin of my Contact web page.
These photos are a bit heavy (as a result of they’ve clear background), so the animation begins with a few of them loading through the animation, trying fairly dangerous.
So, to repair it, I have to add this line <hyperlink rel="preload" as="image" href="url-of-the-image.png"/>
to the <head>
.
To attain it, I am utilizing Snippets plugin. If I am not mistaken, the snippet ought to like this:
add_action( 'wp_head', perform () { ?>
perform my_custom_js() {
echo '<hyperlink rel="preload" as="image" href=href="url-of-the-image.png"/>';
}
<?php } );
The factor is that the exact same web page (my Contact web page) is totally different for cellular units: it would not use these .PNG photos as a result of it could be an excessive amount of loading time for a telephone.
This results in my query: Is there a technique to exclude cellular units from the preloading tag I have to add to the top?