kkilobyte / chrome-balls

Bouncing Chrome Balls (from the Chrome App) ported to a PWA
https://www.kkilouwu.bio/games/chrome-balls/
1 stars 0 forks source link

Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data #1

Open kkilobyte opened 1 month ago

kkilobyte commented 1 month ago

When opening chrome.html or index.html you get greeted with a white screen and the following error on devtools console:

Uncaught SecurityError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.
    at BitmapData._initFromImg (ivank.js:1261:18)
    at new BitmapData (ivank.js:1165:9)
    at BIB.Animation.initialize (bib.js:648:28)
    at BIB.World.<anonymous> (bib.js:257:40)
    at Array.forEach (<anonymous>)
    at BIB.World.initWhenLoadComplete (bib.js:256:14)
    at decrementAndCheck (bib.js:166:12)
    at bib.js:179:7
    at bib.js:665:7
    at Array.forEach (<anonymous>)
kkilobyte commented 1 month ago

update: this issue is only present when running from file:// URLs, running from an HTTP server like NGINX or a static web host like Neocities or github pages works perfectly fine