title: How to avoid tainted canvas?
body: <p>I try to save an Canvas as an Image. But it fails always. I was looking up the Internet and Stackoverflow.com but I couldn't find the right answer.
  I use the answer in this <a href="https://stackoverflow.com/questions/25970538/html5-capture-image-of-paused-video-stream-and-save-it">question</a> to get the context. This works fine, but if I use <code>context.toDataURL</code> I receive error <strong>the Uncaught SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.</strong> </p>
  
  <p>I do not understand why I get this until now, because I added to my canvas and to the videostream the attribute <code>crossorigin="anonymous"</code> and if I check the attribute in the javascript section I still receive that crossorigin is anonymous. Therefore it should work. </p>
  
  <pre><code>function captureimage(){
  var canvas = document.getElementById("c");
  var video = document.getElementById("v");
  var ctx;
  if(video.paused) {
      try {
           ctx = canvas.getContext('2d').drawImage(video, 0, 0);
       } catch (e) {
            alert(e);
       }
       var a = ctx.toDataURL();
  }   
  }
  </code></pre>
  
  <p>How can I solve this security issue? I also added <code>Header set Access-Control-Allow-Origin *</code> to my httpd.conf, but this didn't solve the problem either.</p>