Let's say I have an image like this:
<img src="https://via.placeholder.com/150" class="abcd" />
How to make, with CSS only, that the url https://via.placeholder.com/150 is never loaded?
I tried:
.abcd { display: none; }: a GET to the image is still done (you can check with the browser'sDeveloper Tools > Network).abcd { visibility: hidden; }: idemput the
<img>inside a<div>which is itself indisplay: none;: idem, a GET request is still done for the imageI tried the method from Is it possible to set the equivalent of a src attribute of an img tag in CSS?:
.abcd { content:url("https://via.placeholder.com/200"); }but then both https://via.placeholder.com/150 and https://via.placeholder.com/200 were loaded.
.abcd { content: none; }didn't work either
Application: I'm trying to do a 1px-tracking-system for emails, and I want to prevent my own views to be tracked by injecting a custom CSS (with Stylus chrome extension, uBlockOrigin)
Note: Of course, I already read Does "display:none" prevent an image from loading? but it did not give an exact solution for this linked problem.