[英]Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking i
while building a debug toolbar in Django I am getting an error in file toolbar.js ie.在 Django 中构建调试工具栏时,我在文件 toolbar.js 中遇到错误,即。 s.map: HTTP error: status code 404, net:: ERR_UNKNOWN_URL_SCHEME toolbar.js:1 Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain".
s.map:HTTP 错误:状态码 404,net::ERR_UNKNOWN_URL_SCHEME toolbar.js:1 无法加载模块脚本:服务器以“text/plain”的非 JavaScript MIME 类型响应。 Strict MIME type checking is enforced for module scripts per HTML spec.
根据 HTML 规范对模块脚本强制执行严格的 MIME 类型检查。
can anyone tell me the possible fix for that?谁能告诉我可能的解决方法?
I found solution here How to set content type of JavaScript files in Django我在这里找到了解决方案How to set content type of JavaScript files in Django
#settings.py
if DEBUG:
import mimetypes
mimetypes.add_type("application/javascript", ".js", True)
Expanding on drewslee answer扩展drawslee的答案
The solution to the problem is indicated in the documentation问题的解决方案在文档中说明
HKEY_CLASSES_ROOT\.js\Content Type
to text/javascript
.HKEY_CLASSES_ROOT\.js\Content Type
设置为text/javascript
。I have faced the problem and it was fixed after edit the Windows registry.我遇到了这个问题,并且在编辑 Windows 注册表后得到了修复。 I just Set HKEY_CLASSES_ROOT.js\Content Type from text/plain to text/javascript.
我只是将 HKEY_CLASSES_ROOT.js\Content Type 从 text/plain 设置为 text/javascript。
Now the problem is solved!现在问题解决了!
I faced the same error.我遇到了同样的错误。 It was resolved once I updated the
HKEY_CLASSES_ROOT.js\Content Type
from text/plain
to text/javascript
in my Windows using RegistryEditor
.一旦我使用
RegistryEditor
在我的 Windows 中将HKEY_CLASSES_ROOT.js\Content Type
从text/plain
更新为text/javascript
,它就解决了。
After that I had to refresh my browser cache to be able to see the toolbar之后,我必须刷新浏览器缓存才能看到工具栏
就我而言,我尝试在另一台服务器(如 8080)上运行它并且它可以工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.