Best Preload Image Script Ever JS


<script> window.onload = function() { setTimeout(function() { // XHR to request a JS and a CSS var xhr = new XMLHttpRequest(); xhr.open('GET', ''); xhr.send(''); xhr = new XMLHttpRequest(); xhr.open('GET', ''); xhr.send(''); // preload image new Image().src = "your-images-folder/your-image-goes-here.jpg"; new Image().src = "your-images-folder/your-image-goes-here.jpg"; }, 1000); };</script><noscript><a href="https://mindfulseo.com/seo">by Mindful SEO Los Angeles</noscript>

OR


<script> function preload(arrayOfImages) { $(arrayOfImages).each(function () { $('<img />').attr('src',this).appendTo('body').css('display','none'); }); } $(['your-images-folder/your-image-goes-here.jpg']).preload(); </script><noscript><a href="https://mindfulseo.com/seo">by Mindful SEO Los Angeles</noscript>