解决跨域问题:has been blocked by CORS

在编辑器web容器可以显示在浏览器无法显示。
解决跨域问题:报错has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.或者无法加载文件报错from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

方式一
*1.*换chrome浏览器
*2.*在chrome浏览器右键属性–目标–后面加上‘ --allow-file-access-from-files’。注意–allow-file-access-from-files前面有空格
*3.*若还是无法显示就采用拖拽html文件到浏览器图标上运行的方式运行html文件。

方式二:
安装浏览器插件,在插件市场搜索Access-Control-Allow-Origin安装重启浏览器即可。注意先要打开插件开关才有效。

你可能感兴趣的:(html)