Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67497

Prevent images from loading with Javascript

$
0
0

I am writing a script that replaces web page images with webp format. I have control only over my javascript which I can place where ever I want. My question is how to stop completely image load with javascript? I tried to do like this:

let images = document.querySelectorAll('img');
for (let img of images) {
  img.src = '';
}

But when I open the network tab, browsers still download images.


Viewing all articles
Browse latest Browse all 67497

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>