1

I've been researching about canvas and I know security protocol denies outputting/saving the canvas if it has been tainted.

what I can't seem to get an explanation on is what precisely triggers it to be tainted on my end.

I have a div with a background and some draggable content, and want to save the user-created layout as a .png on my server. However, it keeps blocking it due to the tainted canvas security. All of the images within the div (and page) are housed on my site.

Is there some kind of header permission I need to grant to work around this (without permitting others to use my images cross-source on their canvas, etc)?

DissTech
  • 21
  • 1
  • Which browser, and what kind of images are in the doc ? (svg will taint a bunch of them). Are you sure there is not something coming from an external resource (like e.g some hidden icon from a library) ? This latter can be checked in the Network Panel of your dev-tools. – Kaiido May 28 '17 at 03:36
  • Hi Kaiido thanks for the reply. I'm using chrome. the library icons attached to draggable/rotatable images are housed locally (as well as the libraries) – DissTech May 28 '17 at 03:52
  • When you say locally it's through an server right ? (in the network panel, everything comes from your domain, be it `http://localhost` ? Nothing from `file://` ?) And there is no svg with `` ? What if you don't allow html2canvas to taint the canvas ? (don't set `allowTaint` option but add `taintTest` one). Try to remove one thing at a time on your page, until you find what taints the canvas (I would start by this dragging lib). But without seeing the exact page, it's hard for us to help you more than this... – Kaiido May 28 '17 at 04:08
  • Thanks for the suggestion, it's something with the libraries. I'll have to review those and see if I can get them all coming from the same place – DissTech May 28 '17 at 04:32
  • I have all of the libraries housed, but when I add the JS it gets tainted. I isolated the JS libraries and they all cause it to be tainted. – DissTech May 28 '17 at 04:59

0 Answers0