1

I'm trying to create some tool that saves text to images, now i've built something that works with a preview. And it works fine in firefox.

But when i hit the download button in Safari/Chrome it gives me this error: 'Uncaught SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.'

This is the download button code ( i don't see why it's wrong ):

download = document.getElementById('img-download');
download.addEventListener('click', prepareDownload, false);

function prepareDownload() {
   var data = canvas.toDataURL();
   download.href = data;
}

Here is a JSfiddle to maybe get a better understanding of the problem: http://jsfiddle.net/29M7P/

Any help is highly appreciated.

user2099810
  • 361
  • 5
  • 15
  • 1
    possible duplicate of [Cross-origin data in HTML5 canvas](http://stackoverflow.com/questions/9972049/cross-origin-data-in-html5-canvas), http://stackoverflow.com/q/20424279/3278057 etc. – user13500 Mar 31 '14 at 12:33
  • wow.. that was far more easy than expected... thanks – user2099810 Mar 31 '14 at 12:37
  • Yes, it is usually a *downer* once one realize this limitation. Though one can fix it if one can use server scripts etc. Local images uploaded by user are also OK. – user13500 Mar 31 '14 at 12:48

0 Answers0