如果没有用作“image / x-icon”,IE浏览器不会在HTML中显示.ico图标。 [英] IE doesn't show .ico icons in HTML if not served as "image/x-icon"

查看:965
本文介绍了如果没有用作“image / x-icon”,IE浏览器不会在HTML中显示.ico图标。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在列表中显示网站的图标,例如< img /> 元素。



有些网站可以提供这些服务:


  < link rel =icontype =image / x-iconhref =favicon.ico/> 

有些可作为服务:

 < link rel =快捷图标href =favicon.ico/> 

IE 不显示图标有 type =图片/ x-icon


我无法控制网站如何服务于他们的图标,所以我可以从我身边做些什么?

解决方案 div>

我认为最好的办法是将它们转换为另一种格式。如果您手动显示图标,那么您可以下载每个图片,并将其转换为图片程序,然后将其上传到您的网站。



如果您自动执行此操作您需要查看您在服务器端获得的任何图像处理工具。如果您使用的是PHP,那就是 GD ImageMagick 库。



如果IE浏览器没有显示与网页内嵌的.ico文件,那么你不太可能会这样能够在不进行某种处理的情况下进行显示。在最简单的层面上,您可以只读取外部图像并将其作为正确的mime类型提供,而无需转换它们。


I'm showing favicons of websites in a list, as <img /> elements.

some websites serve them as:

<link rel="icon" type="image/x-icon" href="favicon.ico" />

and some serve them as:

<link rel="shortcut icon" href="favicon.ico" />

IE doesn't show the favicons images of those of don't have type="image/x-icon".
I cannot control how websites serves their favicons, so what can I do from my side?

解决方案

I think the best thing to do is convert them to another format. If you are displaying the icons manually then you could download each, convert it with an image program, and upload it to your site.

If you're doing it automatically you'll need to look at whatever image-handling tools you get on the server-side. If you're using PHP, that'd be the GD or ImageMagick libraries. Just convert to PNG for example, and cache it on your site.

If IE doesn't display .ico files inline with a page, then it's unlikely you're gonna be able to make it display without doing some kind of processing. At the most simple level, you can just read the external images and serve them up as the right mime type, without converting them.

这篇关于如果没有用作“image / x-icon”,IE浏览器不会在HTML中显示.ico图标。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆