Domanda

I want to create image from my canvas, I'm using kineticjs, but I get error: "Kinetic warning: Unable to get data URL. Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported." I suppose, that it's caused by cross-origin error. In canvas I use localy saved images and address path starts with "file://..". Is there any solution how to create image without apache installing? Thanks.

È stato utile?

Soluzione

Your local hard drive is deemed to be "other domain" by browsers and will taint Canvas.

That's a good thing! You don't want malicious code to get at stuff on your personal drive.

Some workarounds:

  • Install a web server on your computer.

  • Put your image(s) and all files associated with your web app on the desktop (this may/may not help depending on where you got the images to begin with).

  • Temporarily host your images on a site that allows anonymous cross-origin access to your images.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top