CORS headers for accessing a file on another domain

非 Y 不嫁゛ 提交于 2019-12-01 12:03:18

My first thought is that the problem is your

Access-Control-Allow-Origin: *, *

I don't think it is understanding the *, * thing. Try just *.

Edit: you can check what the header really looks like with a command like this:

curl -v -o /dev/null http://williamgreen.hopto.org/audioVisualization/song.mp3

And, lo, it even works for me, yielding (among a lot of other headers):

< Access-Control-Allow-Origin: *

So that is hunky-dory.

Second, are you running this from a file: origin? That doesn't work on Chrome (I thought it would work on Firefox, but maybe that's changed). You have to run it from an http: or https: origin.

By "running from an file: origin" I mean, is the HTML file that is running that Javascript being loaded from an URL that beings with "file:". If so, that is not likely to work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!