Resource interpreted as Script but transferred with MIME type text/html
来源:互联网 发布:淘宝店手机类目能改吗 编辑:程序博客网 时间:2024/05/20 00:11
在开发的一个项目中有用PHP生成JS代码的功能,程序在引用的时候一切正常。但是在Chrome浏览器里显示:"Resource interpreted as Script but transferred with MIME type text/html: ….. "。
这是由于服务器端给你发回的http响应的content-type值是text/plain(默认)而你所期望返回的是兼容javascript类型的。所以浏览器提示上面的警告信息。
解决方法,可以在服务器端的返回字段里增加:Content-type:application/x-javascript。由于我使用的是PHP所以在代码前面使用header输出:
PHP里设置MIME:
<?php header('Content-type: application/x-javascript'); ?>
用script做ajax跨域,请求返回的是个文本字符串,chrome提示:
Resource interpreted as Script but transferred with MIME type text/html.
(请求的是script文件,返回的却是个文本格式)
貌视chrome浏览器比较认这个格式~,去掉<!DOCTYPE html>就行了。
0 0
- 关于chrome Resource interpreted as Script but transferred with MIME type text/html的问题
- 关于chrome Resource interpreted as Script but transferred with MIME type text/html的问题
- Resource interpreted as Script but transferred with MIME type text/html
- golange 错误如下 Resource interpreted as Script but transferred with MIME type text
- Chrome 报 Resource interpreted as Script but transferred with MIME type text/plain 警告的解决办法
- 关于 Resource interpreted as Script but transferred with MIME type text/plain问题的处理
- Chrome 报 Resource interpreted as Script but transferred with MIME type text/plain 警告的解决办法
- Resource interpreted as Stylesheet but transferred with MIME type text/html:以及Uncaught SyntaxError:
- Java过滤器引发的异常:Resource interpreted as Stylesheet but transferred with MIME type text/html
- web——css和图片突然加载不了,console报错:Resource interpreted as script but transferred with MIME type text/html.
- SpringMVC Resource interpreted as Script but transferred with MIME type application/octet-stream:
- 样式加载不出来,浏览器控制台报错:Resource interpreted as Stylesheet but transferred with MIME type text/html
- Resource interpreted as Image but transferred with MIME type text/plain 警告解决方案
- Resource interpreted as Stylesheet but transferred with MIME type text/plain
- 关于easyui Resource interpreted as Document but transferred with MIME type application/json
- Resource interpreted as Stylesheet but transferred with MIME type application/x-css
- Resource interpreted as Font but transferred with MIME type application/x-font-woff
- Resource interpreted as Document but transferred with MIME type application/json ...
- svn log 高级应用
- 此贴为证,程序员注定是默默的逆袭
- LeetCode Unique Binary Search Trees II
- Lighttpd下WORDPRESS的URL Rewrite伪静态规则
- 星型拓扑结构
- Resource interpreted as Script but transferred with MIME type text/html
- link和domain两个指令大盘点
- 2014.3.5 DB2下常用操作
- sdfsfdsfddfsfdsdfdfdf
- 好文学作品
- HDU ACM 1058 JAVA
- 排序学习ING.......
- 嵌入式Linux中initrd的应用--浅析ramdisk、ramfs、initrd和initramfs
- Cross validation的一点笔记