html5 canvas 加载图片错误 SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement'
2017-10-18 18:31
1031 查看
html5 canvas 加载图片错误 SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported
原因:跨域加载图片
解决方案:
javascript :
server 返回的http response中要加以下值到header:
原因:跨域加载图片
解决方案:
javascript :
<img src="your_domain.com/img.png" crossorigin="Anonymous" />
<script> var image = new Image(); image.crossOrigin = "Anonymous"; ... </script>
server 返回的http response中要加以下值到header:
Access-Control-Allow-Origin "*"
相关文章推荐
- 利用HTML5 canvas合并图片并解决Filaed to execute 'toDataURL' on 'HTMLCanvasElement'异常
- Ueditor一加载就报Uncaught TypeMismatchError: Failed to execute 'removeAttributeNode' on 'Element'
- 报错:Uncaught SecurityError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canva
- Uncaught SyntaxError: Failed to execute 'querySelectorAll' on 'Element': '#00' is not a valid select
- HTML5 Canvas ( 图片绘制 转化为base64 ) drawImage,toDataURL
- 将HTML5 Canvas的内容保存为图片借助toDataURL实现
- Uncaught SecurityError: Failed to execute 'replaceState' on 'History':解决方案
- 2016.8.19 在dialog上增加一个button出现错误:failed to execute setAttribute on Element...
- 2016.8.19 在dialog上增加一个button出现错误:failed to execute setAttribute on Element...
- 将HTML5 Canvas的内容保存为图片借助toDataURL实现
- Jquery 报错 Uncaught InvalidStateError: Failed to set the 'value' property on 'HTMLInputElement':
- Failed to execute 'setSelectionRange' on 'HTMLInputElement'
- 将HTML5 Canvas的内容保存为图片借助toDataURL实现
- 将HTML5 Canvas的内容保存为图片借助toDataURL实现
- Uncaught InvalidCharacterError: Failed to execute 'setAttribute' on 'Element': '"' is not a valid at
- UE报错:Uncaught TypeMismatchError: Failed to execute 'removeAttributeNode' on 'Element'解决方案
- HTML5 Canvas的内容保存为图片toDataURL()
- ueditor编辑器无法粘人表格,Uncaught TypeMismatchError: Failed to execute ‘removeAttributeNode’ on ‘Element’: T
- hadoop错误java.io.IOException Failed to replace a bad datanode on the existing pipeline due to no more
- 记一次elementUI Icon 加载无效的问题。并且提示错误 Failed to decode downloaded font: