Chrome跨域问题

从网上下载的html本地运行,出错,按F12,发现:

Access to script at 'file:///F:/xxx/yyy.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

按网上解决方法,在chrome快捷方式“目标”:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --allow-file-access-from-files

运行不出这个错了,又换了一个错误:

Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.

还是没有解决,win10上正好有Ubuntu,进入html目录,运行:

python -m SimpleHTTPServer 8080

就启动一个服务器了,再在chrome里输入:

http://localhost:8080/

就可以选择打开需要的网页了,运行OK。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值