+ 2

How to fetch image data from image url , create blob and image url from it ? [solved]

I tried something but i get an error and i have no idea why is it happening . Any help is much appreciated! https://code.sololearn.com/WCkZpODec3BS/?ref=app

31st Aug 2021, 6:53 PM
Abhay
Abhay - avatar
4 Réponses
+ 4
Abhay Write whole js code inside this function: window.onload = function () { }
31st Aug 2021, 6:59 PM
A͢J
A͢J - avatar
+ 3
Declare img inside .then(data=>{ let img=document.querySelector("img"); and yes Abhay Your HTML contens load before the JavaScript so you have to write JavaScript code inside the window.onload function so your Javascript code will execute after loading HTML contents. window.onload = function () { //Your code }
31st Aug 2021, 6:59 PM
Pariket Thakur
Pariket Thakur - avatar
+ 2
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ tyvm :)! I thought it would take me hours to resolve and even then i wouldn't find a solution for it .
31st Aug 2021, 7:09 PM
Abhay
Abhay - avatar
+ 1
HrCoder ty ! yes i know but i completely forgot about it since it is something that you don't need to worry about when using other ide.
31st Aug 2021, 7:06 PM
Abhay
Abhay - avatar