from origin ‘null‘ has been blocked by CORS policy: Cross origin requests are only supported for pro


 

参考文章

visual studio code 中使用 open in browser 插件,在浏览器中打开 html 文件后,如下图所示:

 

从Sources选项卡中可以看出来,并没有加载 javascript 文件,如下图所示:

 

每个人开发自己的模块

报错内容为:
Access to script at 'file:///D:/My%20Study/Vue/learn-vuejs/LearnVuejs04/12-%E5%89%8D%E7%AB%AF%E6%A8%A1%E5%9D%97%E5%8C%96/02-ES6%E7%9A%84%E6%A8%A1%E5%9D%97%E5%8C%96%E5%AE%9E%E7%8E%B0/xiaoming.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, edge, https, chrome-untrusted.

解决办法:
我这里安装了 node.js 环境,使用 npm 安装 anywhere ,npm install anywhere -g 如下图:

 

 


切换到需要运行的 html 文件的目录,在 cmd 中运行 anywhere,如下:

 

 

运行 anywhere 后发现,js 文件全部加载进来了。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 axios 访问本地文件 报跨域错误 from origin 'null' has been blocked by CORS policy 跨域问题解决Access to image at 'file:///png' from origin 'null' has been blocked by CORS policy ElementUI项目请求SpringBoot后台项目时提示:Access to XMLHttpRequest at **from origin ** has been blocked by CORS policy Access to XMLHttpRequest at 'XXX' from origin 'XX' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present o AJAX跨域请求解决方法 【SpringBoot】has been blocked by CORS policy:The 'Access-Control-Allow-Origin' header contains multiple values 'xxx, xxx', but only one is allowed. 【跨域问题】Access to XMLHttpRequest at ‘A’from ‘B’has been blocked by CORS policy :... No ‘Access-Control-Allow-Origin’ header...(Chrome浏览器) VUE里面调用高德地图出现跨域和Access to XMLHttpRequest at 'https://restapi.amap.com/v3/geocode/regeo?xx' from origin 'http://xxxx:8080' has been blocked by CORS policy: The value of the 'Access-Contr 解决[origin 'http://xxx.xxx.com:xxxx' has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space `local`.] has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. 跨域详解 been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM