sumimakito / Awesome-qr.js

An awesome QR code generator written in JavaScript.
https://www.bitcat.cc/webapp/awesome-qr/index.html
Apache License 2.0
1.67k stars 251 forks source link

SecurityError while using it with the browser #66

Open rbalet opened 3 years ago

rbalet commented 3 years ago

Description

I know this isnt't a awesome-qr.js specific error, but it could be useful to add it in the documentation.

Error

When using the code in the browser, I get the following error

ERROR Error: Uncaught (in promise): SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
Error: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.

This is du to the cross-origin use of images and canvas https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image