当我尝试将本地JavaScript文件的链接引用更改为GitHub原始版本时,我的测试文件停止工作.错误是:
拒绝从...执行脚本,因为它的MIME类型(
text/plain)不可执行,并且启用了严格的MIME类型检查.
有没有办法禁用此行为或是否有允许链接到GitHub原始文件的服务?
工作代码:
<script src="bootstrap-wysiwyg.js"></script>
Run Code Online (Sandbox Code Playgroud)
非工作代码:
<script src="https://raw.github.com/mindmup/bootstrap-wysiwyg/master/bootstrap-wysiwyg.js"></script>
Run Code Online (Sandbox Code Playgroud) 我问了一个关于从GitHub中包含资源的问题,答案是使用原始链接:
https://raw.github.com/username/repository/branch/file.js
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用以下内容包含脚本:
<script
type="text/javascript"
src="https://raw.github.com/username/repo/master/src/file.js"
></script>
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
拒绝执行' https://raw.github.com/username/repo/master/src/file.js '中的脚本,因为它的MIME类型('text/plain')不可执行,并且启用了严格的MIME类型检查.
有没有其他方法可以解决此错误?
我不是在制作中使用它而是用于演示页面:
project-repository-from-github
?? master
? ?? src
? ? ?? my-jQuery-plugin.js
? ?? README.md
?? gh-pages
?? css
? ?? style.css
?? index.html
Run Code Online (Sandbox Code Playgroud)
在index.html页面中,我想拥有my-jQuery-plugin.js的最新版本.所以,我会将原始URL包含在脚本中.
我该如何修复错误?