使用canvas绘图时,为什么不通过CORS使用图片会污染画布?按MND的说法是:可避免未经许可拉取远程网站信息而导致的用户隐私泄露。那是怎么通过加载图片导致用户隐私泄漏的?..为什么普通在html中使用img标签或者css中使用background加载图片不需要走CORS去加载呢并且不泄漏隐私呢?网上搜到的答案清一色是关于如何解决canvas跨域,请各路大佬传授一下新知识..
2 回答
慕妹3146593
TA贡献1820条经验 获得超9个赞
Becausethepixelsinacanvas'sbitmapcancomefromavarietyofsources,includingimagesorvideosretrievedfromotherhosts,it'sinevitablethatsecurityproblemsmayarise.AssoonasyoudrawintoacanvasanydatathatwasloadedfromanotheroriginwithoutCORSapproval,thecanvasbecomestainted.Ataintedcanvasisonewhichisnolongerconsideredsecure,andanyattemptstoretrieveimagedatabackfromthecanvaswillcauseanexceptiontobethrown.IfthesourceoftheforeigncontentisanHTMLorSVG
添加回答
举报
0/150
提交
取消