svga / SVGAPlayer-Web

Similar to Lottie. Render After Effects / Animate CC (Flash) animations natively on Android and iOS, Web. 使用 SVGAPlayer 在 Android、iOS、Web中播放 After Effects / Animate CC (Flash) 动画。

Home Page:https://svga.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

官方提供的例子和本地自己测试都提示Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. 请问有解决方案吗?

xiongminghui opened this issue · comments

Access to XMLHttpRequest at 'file:///C:/Users/Administrator/Desktop/SVGAPlayer-Web-master/tests/samples/matte.svga' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

官方例子里面都是这个问题,加载本地文件都是报错,想用base64来取巧弄一下,不行也报错,请问有解决方案吗

https://developer.mozilla.org/zh/docs/Web/HTTP/Access_control_CORS
http://www.ruanyifeng.com/blog/2016/04/cors.html
你先了解一下什么叫 CORS

你说的这个我再其他issue提问里了解过了,现在是官方给的例子下载了测试一下,加载本地文件都报错,还有现在很多文件大家都放在各种oss云服务上 没法让别人开房cors所有,官方能提供一个解决思路吗,看其他issue有人提到base64解决 试验了没成功,网上实在找不到解决办法才提issue的

加载一个 file:// 啊……怎么可能用 XMLHTTPRequest 加载一个 file 能成功的呢。

另外 CORS 的问题,你去问后端吧,这不是 Player 的问题。

另外 CORS 的问题,你去问后端吧,这不是 Player 的问题。

好的 感谢