请教各位一个问题,求解答:关于canvas图片跨域问题十分感谢

使用canvas绘图时,为什么不通过CORS使用图片会污染画布?按MND的说法是:可避免未经许可拉取远程网站信息而导致的用户隐私泄露。那是怎么通过加载图片导致用户隐私泄漏的?..
为什么普通在html中使用img标签或者css中使用background加载图片不需要走CORS去加载呢并且不泄漏隐私呢?
网上搜到的答案清一色是关于如何解决canvas跨域,请各路大佬传授一下新知识..
FFIVE
浏览 400回答 2
2回答

慕妹3146593

Becausethepixelsinacanvas'sbitmapcancomefromavarietyofsources,includingimagesorvideosretrievedfromotherhosts,it'sinevitablethatsecurityproblemsmayarise.AssoonasyoudrawintoacanvasanydatathatwasloadedfromanotheroriginwithoutCORSapproval,thecanvasbecomestainted.Ataintedcanvasisonewhichisnolongerconsideredsecure,andanyattemptstoretrieveimagedatabackfromthecanvaswillcauseanexceptiontobethrown.IfthesourceoftheforeigncontentisanHTMLorSVGelement,attemptingtoretrievethecontentsofthecanvasisn'tallowedYoucanreadmoreaboutthishere
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript