is there a way with javascript/jquery to prevent images from loading? I am building a slideshow from a html list with images. So I would like to collect all the src data and then prevent the images from loading. So later when the user really needs the image I would load it then.
I found some lazy loading script on google but couldn't find the way they prevent images from loading.
Thanks in advance.
Edit1:
It seems from the answers that it's not possible to use javascript to prevent images from loading. Here is a script that does lazy loading. Could anybody explain how it works? It seems when javascript is off it just loads the images normaly and when it's on it will load them when you scroll to their location.
How to disable image files from displaying in Chrome? Open Google Chrome and click the Customize / Control Google Chrome button > Settings. Scroll down and click on "Show Advanced settings ". In the Privacy section, click on Content settings....
Here's how. 1. Launch Firefox, type in about:config in the address bar, and hit Enter. That is where you can turn on or off the auto image loading option.
If you make the image a background-image of a div in CSS, when that div is set to "display: none", the image will not load. When CSS is disabled, it still will not load, because, well, CSS is disabled.
You can wrap the image in a noscript tag:
<noscript> <img src="foo.jpg"/> </noscript>
All browsers that has JavaScript enabled will ignore the image tag so the image won't load.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With