I have this code:
var url2 = 'https://vechainstats.com/nft/vereapers/2576/';
var img = document.createElement('img');
img.src = url2;
The link doesn't exist. So, I get in the console:
How can I get this error message (404) in JavaScript?
Thank you
I've tried adding addEventListener('error')
to img
but the log
doesn't show 404 error. I've tried try / catch
. I've tried fetch
(CORS & CORB problems).