新手问题 关于 “MIME type ('application/json') is not executable” 报错

zicjin · 2014年07月13日 · 23461 次阅读

我有一个 controoller 返回值是这样写的:

render :json => topics

没有写 respond_to,只输出 json。在浏览器访问这个路径返回的是正常的 json 结果。但是我在另一个页面中通过 jquery/jsonp 跨域 ajax 访问这个路径就 会出现这样的报错: because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.

我知道 jsonp 实际请求的 url 是类似这样的: http://192.168.33.10:3000/topic?callback=jQuery110207993173841387033_1405255955642&_=1405255955643 上面这个路径在浏览器访问返回结果也是正常的。

所以,这个“MIME type ('application/json') is not executable”是什么问题,怎样配置的?

暂无回复。
需要 登录 后方可回复, 如果你还没有账号请 注册新账号