You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.
Now there is no handling if one of specified images was NOT loaded (I tell about browser implementation).
This is bad for frontend applications not to have ability to handle such errors: if URL returns 404, the application just will discontinue working in the silence.
But looks like this solution is not cross-browser (see link).
I suppose the best solution is to use File API.
I've tried to do this by myself, but I unable to convert read binary PNG (or any other format) data to BLOB to pass it to FileReader. Maybe you will get luck with this.
The text was updated successfully, but these errors were encountered:
And one another pitfall for loading loading images data inside tag: if you use some API and load image at one URL many times, you will see that browser caches images and you can not be sure that image was really reloaded. Adding "?someUniqId" is not possible in some cases (you can break API URL format, this works guaranteed fine only if you request static files and only if there are no custom server limits).
Hi,
Now there is no handling if one of specified images was NOT loaded (I tell about browser implementation).
This is bad for frontend applications not to have ability to handle such errors: if URL returns 404, the application just will discontinue working in the silence.
As I see the code:
you use DOM API to load image.
So you can at least use this to handle failures:
https://stackoverflow.com/questions/9815762/detect-when-an-image-fails-to-load-in-javascript
But looks like this solution is not cross-browser (see link).
I suppose the best solution is to use File API.
I've tried to do this by myself, but I unable to convert read binary PNG (or any other format) data to BLOB to pass it to FileReader. Maybe you will get luck with this.
The text was updated successfully, but these errors were encountered: