Untitled

mail@pastecode.io avatarunknown
javascript
a month ago
240 B
7
Indexable
Never
var preloadLinks = document.querySelectorAll('link[rel="preload"]');

preloadLinks.forEach(function(link) {
  var href = link.getAttribute('href');
  if (href && href.endsWith('.webp')) {
    link.setAttribute('as', 'image');
  }
});