golange 错误如下 Resource interpreted as Script but transferred with MIME type text
2013-04-10 11:10
393 查看
这是由于服务器端给你发回的javascript http响应的content-type值是text/plain(默认。)而你所期望返回的是兼容javascript类型的。
解决方法,可以在服务器端的返回字段里增加:content-type
: application/x-javascript
具体在golang的解决方案如下:
解决方法,可以在服务器端的返回字段里增加:content-type
: application/x-javascript
具体在golang的解决方案如下:
func router(w http.ResponseWriter, r *http.Request) { r.ParseForm() url := r.URL.Path switch{ 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) } }
相关文章推荐
- 关于chrome 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/html的问题
- Chrome 报 Resource interpreted as Script but transferred with MIME type text/plain 警告的解决办法
- Resource interpreted as Script but transferred with MIME type text/html
- web页面 显示 Resource interpreted as Stylesheet but transferred with MIME type text/plain的错误警告
- Resource interpreted as Script but transferred with MIME type text/plain:
- 关于 Resource interpreted as Script but transferred with MIME type text/plain问题的处理
- web——css和图片突然加载不了,console报错:Resource interpreted as script but transferred with MIME type text/html.
- Chrome 报 Resource interpreted as Script but transferred with MIME type text/plain 警告的解决办法
- Chrome 报 Resource interpreted as Script but transferred with MIME type text/plain 警告的解决办法
- odoo 错误 Resource interpreted as Stylesheet but transferred with MIME type application/x-css:
- Resource interpreted as Stylesheet but transferred with MIME type text/html:以及Uncaught SyntaxError:
- 建站记录2-CSS文件未加载-已解决-Resource interpreted as Stylesheet but transferred with MIME type text/plain
- Resource interpreted as Stylesheet but transferred with MIME type text/plain
- Java过滤器引发的异常: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
- Resource interpreted as Document but transferred with MIME type application/json ...
- 谷歌浏览器下在文本框中敲回车会下载。。。Resource interpreted as Document but transferred with MIME type application/json