跨域的系列内容之一。
跨域问题简单讲就是资源获取问题,但深入的讲,还得分为你是用什么操作去获取数据,获取数据的程序来定。今天记录典型的音频audio跨域问题。
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
读取并不预加载,正常,可播放。
1 |
<audio id="mp3" src="url" controls="controls"></audio> |
读取并预加载,失败,提示跨域。