test Html5

chrome 控制台出现 Uncaught SecurityError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.IE和edge是好的,就是将彩色图片变成黑白图片


相关问题canvas 跨域问题
在stackoverfow 上有相关提问 canvas CORS
看不懂stackoverflow解决办法 “To solve the cross domain issue with file://, you can start chrome with the parameter” --allow-file-access-from-files
src= "images/004.jpg" 这也算跨域? 我对跨域的理解就是必须协议相同,域名一样,端口一样。
那么chrome 这个问题该如何解决,以后的解决跨域有没有一些好的方法?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
试试
img.crossOrigin = "Anonymous";因为你没在服务器浏览,所以报错了,
Canvas是不支持跨域的,改浏览器启动参数只是让自己电脑支持而已,解决不了真正的跨域问题
1.起个服务器再在chrome里试一下,应该会跑通。
2.右键chrome,属性,在目标后面加上(有个空格) --allow-file-access-from-files
这是改启动参数。大概是chrome的神秘本地文件限制吧。。既然有外国小哥教那最好了。
跨域确实如你所说;你在本地没服务器跑,就是浏览器自己问题
我替你stackoverflow 了一下,大概跟楼上基本一样了。-,-
原文在此:https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally