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.