流星:资源解释为图像,但用MIME类型text / html传输 [英] Meteor: Resource interpreted as Image but transferred with MIME type text/html
问题描述
<$ 我使用Meteor 0.5.2,并在Chrome中获得了以下每个图像的警告: c $ c> Resource解释为Image,但是使用MIME类型text / html传输:
http:// localhost:3000 / images /。 domutils.js:126
在我的模板中,我像这样定义了图片:
< IMG SRC = 图像/ {{userOwnerAvatar}} ALT = 宽度= 32 HEIGHT = 32/>
我使用模板辅助函数来提取确切的图像名称(例如avatar.jpg )来自Mongo。
当我将图像名称直接键入模板(硬编码图像名称)时,警告消失。
例如
< IMG SRC = 图像/ avatar.jpg ALT = width =32height =32/>
为什么我不断收到此警告,我该怎么办?
谢谢,弗拉基米尔
的{{userOwnerAvatar}}不正确解析的值,这就是为什么你的浏览器说http:// localhost:3000 / images /被解释为文本/ html(注意缺少该URL中的实际图像文件名)。修复你的模板助手: - )
I am using Meteor 0.5.2 and getting following warning in Chrome for each of images which have their src generated by a template helper:
Resource interpreted as Image but transferred with MIME type text/html:
"http://localhost:3000/images/". domutils.js:126
In my template I defined the image like this:
<img src="images/{{userOwnerAvatar}}" alt="" width="32" height="32" />
I am using a template helper function to pull out the exact image name (e.g. "avatar.jpg") from Mongo. All images are visible and loaded correctly in browser.
When I type in the image name directly into template (hardcode image name) the warning disappears.
e.g.
<img src="images/avatar.jpg" alt="" width="32" height="32" />
Why do I keep getting this warning and what can I do about it?
Thanks, Vladimir
The value of {{userOwnerAvatar}} is not resolving correctly, which is why your browser is saying that "http://localhost:3000/images/" was interpreted as text/html (note the lack of the actual image filename in that URL). Fix your template helper :-)
这篇关于流星:资源解释为图像,但用MIME类型text / html传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!