I have a css file with 500 images embedded as background images with the css url function. Browsers will only load images that are shown on screen, but I noticed in my server logs that from time to time, all of the 500 images were fetched in a row.
I thought that maybe when Cloudflare served the css file, it parsed it and fetched all the images to be ready when the browser will run the css file itself and ask for some of the images listed.
Cloudflare doesn’t do that, no. But there is no guarantee that a browser will behave as you expect and only download images that are actually being displayed (and older ones certainly won’t behave that way).
I had a difficult time to find authoritative content about how browsers handle this situation, but given the user agents I have in the log I am pretty sure this is not a browser that tries to fetch all these assets at once (plus, the number of concurrent calls are limited in the browser).
Now I need to find another explanation. Thank you.