【发布时间】:2015-01-22 05:57:54
【问题描述】:
在我的 Angular 应用程序中,我正在使用上传字段,并在文件字段下方显示上传图像的缩略图。图片已上传并显示缩略图,但有时缩略图未显示,当时我收到此错误Resource interpreted as Image but transferred with MIME type text/html
但同一图像有时可能有效,有时可能无效。这是.httaccess 的问题吗?
RewriteEngine On
RewriteBase /foldername/
RewriteCond %{REQUEST_URI} !^(/index\.php|/img|/js|/css|/robots\.txt|/favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.html [L]
【问题讨论】:
-
查看浏览器控制台的网络选项卡以查看返回的确切内容,包括标题。
-
在响应头中我得到了 Content-Type:text/html
-
但是正文中返回了什么?什么是状态?我的猜测是 404 页面或类似的东西
-
angular 正在加载项目的背景,然后浏览器挂了..
-
这也发生在我身上。好奇您是否能够找到解决此问题的方法。我已经尝试了几件事,比如设置新的内容类型标题、将我的 div 标签切换到一个对象并在那里设置内容类型,但仍然得到 text/html。在 localhost 中工作正常,但在部署时不能。
标签: html angularjs mime-types meta-tags