Chrome 显示“资源被解释为脚本,但使用 MIME 类型 text/plain 传输",这是什么意思? [英] Chrome says "Resource interpreted as script but transferred with MIME type text/plain.", what gives?

查看:45
本文介绍了Chrome 显示“资源被解释为脚本,但使用 MIME 类型 text/plain 传输",这是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 FF 中,我的 javascript 工作正常.但在 Chrome 中,它给出了以下消息:

In FF and all, my javascript works fine. But in Chrome it gives this message:

资源被解释为脚本,但以 MIME 类型 text/plain 传输.

Resource interpreted as script but transferred with MIME type text/plain.

我检查了所有脚本标签,它们都有MIME type="text/javascript".它甚至用 jquery 和 jquery ui 也是如此.Chrome 有什么问题?

I have checked all the script tags and they all have the MIME type="text/javascript". It even says so with jquery and jquery ui. What is wrong with Chrome?

这是什么问题和解决方法?是我必须在浏览器的选项"中更改还是从服务器更改,或者我是否必须调整我的代码?

What's the problem and the fix for this? Is it something I have to change in the 'options' of the browser or is it from the server, or do I have to tweak my code?

推荐答案

表示服务器正在发送一个 Javascript HTTP 响应

It means that the server is sending a Javascript HTTP response with

Content-Type: text/plain

您需要配置服务器以使用

You need to configure the server to send a JavaScript response with

Content-Type: application/javascript

这篇关于Chrome 显示“资源被解释为脚本,但使用 MIME 类型 text/plain 传输",这是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆