【odoo10】Refused to execute script from '*' because its MIME type ('text/plain') is not executable

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/quanwei132/article/details/53993053

软件环境:window10

编译环境:python2.7.9,pycharm4.5.3 ,nodejs6.9

问题描述:当开发环境搭建成功,启动odoo9或者odoo10后(已创建数据库),登陆访问报错如下

web:1 Refused to execute script from '*/web.assets_common.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled


问题截图如下

分析服务端在Response中设置了X-Content-Type-Options:nosniff ,告诉浏览器强制检查资源的MIME,进行加载,

但是,web.assets_common.js原本就是js文件,浏览器把该文件当作“纯文本”(file.content_type:text/plain)解析。

故用任何浏览器都会报错。

原因:可能是pycharm或者nodejs 合并压缩JS过程中,把文件类型改成了text/plain;这个过程我还不知道什么原因,后续了解了,再补充。

扫描二维码关注公众号,回复: 4185092 查看本文章

解决方案

查询数据库找到后台返回的文件类型text/plain
select * from ir_attachment where mimetype ='text/plain' and datas_fname like '%.js';
把mimetype字段的值:text/plain 改为 text/javascript

猜你喜欢

转载自blog.csdn.net/quanwei132/article/details/53993053