I have a tiny webapp, I have multiple folders in it (each folder name is an ID), in each folder there are an image that can be JPG, PNG or GIF
The structure is this:
$("#logo").attr('src','../images/article/'+json.id+'/logo.jpg');
I don't know the real extension of the file, many articles have JPG, other have PNG and some others have GIF extension, that's all the possibilities.
How can I guess and set the right extension, maybe using a sort of onerror
event?
Thanks for reading, and please forgive my bad english!