golange 错误如下 Resource interpreted as Script but transferred with MIME type text
来源:互联网 发布:unity3d java服务器 编辑:程序博客网 时间:2024/05/19 21:40
这是由于服务器端给你发回的javascript http响应的content-type值是text/plain(默认。)而你所期望返回的是兼容javascript类型的。
解决方法,可以在服务器端的返回字段里增加:content-type : application/x-javascript
具体在golang的解决方案如下:
func router(w http.ResponseWriter, r *http.Request) {r.ParseForm()url := r.URL.Pathswitch{case "/demo_workers.js" == url:w.Header().Add("Content-Type", "application/x-javascript")t, _ := template.ParseFiles("demo_workers.js")t.Execute(w, nil)default:t, _ := template.ParseFiles("demo_workers.html")t.Execute(w, nil)}}
- golange 错误如下 Resource interpreted as Script but transferred with MIME type text
- 关于chrome Resource interpreted as Script but transferred with MIME type text/html的问题
- 关于chrome Resource interpreted as Script but transferred with MIME type text/html的问题
- Chrome 报 Resource interpreted as Script but transferred with MIME type text/plain 警告的解决办法
- Resource interpreted as Script but transferred with MIME type text/html
- 关于 Resource interpreted as Script but transferred with MIME type text/plain问题的处理
- Chrome 报 Resource interpreted as Script but transferred with MIME type text/plain 警告的解决办法
- SpringMVC Resource interpreted as Script but transferred with MIME type application/octet-stream:
- Resource interpreted as Stylesheet but transferred with MIME type text/html:以及Uncaught SyntaxError:
- Resource interpreted as Image but transferred with MIME type text/plain 警告解决方案
- Java过滤器引发的异常:Resource interpreted as Stylesheet but transferred with MIME type text/html
- Resource interpreted as Stylesheet but transferred with MIME type text/plain
- web——css和图片突然加载不了,console报错:Resource interpreted as script but transferred with MIME type text/html.
- 样式加载不出来,浏览器控制台报错:Resource interpreted as Stylesheet but transferred with MIME type text/html
- 关于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 ...
- [算法] poj 3356 字符串的距离 AGTC
- multiple definition of 问题解决方法
- netfilter与用户空间通信二法
- bash 初探与PATH 详解
- 操作系统小结
- golange 错误如下 Resource interpreted as Script but transferred with MIME type text
- Linux环境下PostgreSQL与PostGIS的安装与配置
- 多线程常用语法
- 新手写OFBiz的HelloWorld
- Intellij IDEA 自动生成 serialVersionUID
- Java中static、final用法小结
- ABAP总结-转载,好全啊
- 利用隐私循环
- 如何关闭一个swingworker线程?