This has been discussed here and there. I'd made my own solution but I'm wondering if there is some modern official solution by newer standard as ECMAScript 2016.
My solution is a hack in the src property adding a random fake property in the end:
function xhrUrlHackNoCache(first) {
var hack = (first)? "?nocache=" : "&nocache=" ;
for(let i=0; i<5; i++) {
hack += Math.floor(Math.random()*10).toString();
}
return hack;
}
Personally, I think this is ugly...
There is some interesting discussion here. Some I already tested and won't work as header definition, not even when loading the image trough a php script (maybe if I load the image as 64 and create the img object). Maybe manipulating .htaccess file, but I don't have much knowledge about (sometimes I drop my website messing with this file).
The heaven to me will be some img property set to avoid the cache and load this imagem from the file. Is there something like this? What's the best practice in this case today?
If there is nothing new to add to this issue (that has a lot of duplicates) than I might delete it, no problem, but I think is a good idea to update the knowledge about it.