gpt4 book ai didi

javascript - 尝试包含 FileSaver.js 时出错

转载 作者:行者123 更新时间:2023-11-30 08:42:39 24 4
gpt4 key购买 nike

我正在尝试包括 https://github.com/eligrey/FileSaver.js但是在我的 js 文件中出现以下错误。如果这是正确的做法,我该如何修复 MIME 类型?

“拒绝执行来自‘github.com/eligrey/FileSaver.js’的脚本;因为它的 MIME 类型(‘text/html’)不可执行,并且启用了严格的 MIME 类型检查。”

最佳答案

如果您访问该 URL,您可以看到它是一个 HTML 页面,而不是脚本本身。您要么需要下载该 JS 文件,要么使用不同的 URL:

<script src="https://raw.github.com/eligrey/FileSaver.js/master/FileSaver.js"/>

该项目有一个演示目录,你可以在那里找到一个例子: https://github.com/eligrey/FileSaver.js/tree/master/demo

关于javascript - 尝试包含 FileSaver.js 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24832029/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com