一、JS中的Module模块加载
案例:
<script src="./aaa.js" type="module"></script>
<script src="./bbb.js" type="module"></script>
<script src="./aaa2.js" type="module"></script>
运行:
chrome报错
Access to script at 'file:///F:/M/share/AA_JSPlayer(V3.0)_0723/jsdecoder/aaa.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.
test.html:1 GET file:///F:/M/share/AA_JSPlayer(V3.0)_0723/jsdecoder/aaa.js net::ERR_FAILED
分析:
同源策略(Same origin policy),是出于安全而诞生的一种约定,规定了只能在本域内进行资源访问。所谓同源是指"协议+域名