且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2022-04-10 21:35:08

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

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

从技术上讲,这不是错误,而是通知/警告,不应特别引起任何问题;如果有的话,这很好地表明某些浏览器可能会选择忽略此类响应.

Technically that's not an error but a notice / warning and should not cause any issues in particular; if anything it's a good indication that some browsers may choose to ignore such a response.

根据 Content-Type 响应标头>RFC 是:

The correct Content-Type response header for JavaScript according to the RFC is:

Content-Type: application/javascript

text/javascriptapplication/x-javascript 的先前值分别已过时或弃用;也就是说,IE

Previous values of text/javascript and application/x-javascript are either obsolete or deprecated respectively; that said, IE <= 8 will only accept the former so be careful when making any changes to your documents.