栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

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

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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 文件,如下图所示:

html 文件内容如下




    
    
    
    document


    
    
    
    

    
    
    
    


报错内容为:
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 文件全部加载进来了。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/316696.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号