Hi! I’m trying to copy the image on my canvas by using a function called canvas.toDataURL() within my javascript code in my html file. I keep getting an error saying that a tainted canvas can not be exported. If I understand correctly, I need to use a service and enable something called Cross-Origin. I am completely lost! Do I need to write some code on the backend? If so, what do I need to do?
P.S. I’m very new to Web Development
Hello Jerome,
On your wix site, you have to allow CORS - read more about that here: Cross-Origin Resource Sharing (CORS) - HTTP | MDN
To do that it would require adding a header like this:
setRequestHeader(“Access-Control-Allow-Origin”, “*”);
Please note that this raises some security concerns on your website.
Best,
Majd