I have a regular HTML page with some images (just regular HTML tags). I\'d like to get their content, base64 encoded preferably, without the need
Use onload event to convert image after loading
onload
function loaded(img) { let c = document.createElement('canvas') c.getContext('2d').drawImage(img, 0, 0) msg.innerText= c.toDataURL(); }
pre { word-wrap: break-word; width: 500px; white-space: pre-wrap; }