Skip to content

Setting up Favicons in IE8, Firefox, Safari, and Opera

2011 四月 3
by 荒野无灯

Firefox(+Camino), Safari, and Opera:

These browsers are easy to setup and only require a 16×16 image file (png, jpg, or gif) and a link tag in the head tag of your code.

1
<link rel="icon" type="image/png" href="/favicon.png" />

IE automaticaly checks the root directory for a file called favicon.ico, so thats where I recommend placing your image. (/favicon.ico)

You don’t need any link code snippet to make this work, but if you wanted to force IE to find it and or change it for another page you can use the following link code in the head tag.

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

I wrap this code with an IE conditional comment. Although the other browsers recognize this code, it’s not correct if your trying to produce accurate XHTML, because of the space in “shortcut icon”.

1
2
3
<!--[if IE]>
    <link href="/favicon.ico" type="image/x-icon" rel="shortcut icon" />
<![endif]-->

摘自:http://greghostetler.com/2009/02/setting-up-favicons/
mark一下,偷懒,没翻译,童鞋们基本上都知道的,IE这家伙总是喜欢搞特殊。。。。。。。。

喜欢这篇文章吗?

请订阅本站 RSS feed填写您的邮件地址,订阅我们的精彩内容:,欢迎点击这里捐赠以支持荒野无灯转播到腾讯微博 转播到腾讯微博

作者:荒野无灯
出处:Hacklog【Hacklog】

声明: 本站遵循 署名-非商业性使用-相同方式共享 3.0 共享协议. 转载请注明转自Hacklog【荒野无灯weblog】

本文链接: http://ihacklog.com/?p=4337

3 Responses Post a comment
  1. 四月 15, 2011

    好吧,我翻译一下,转走了。。 :oops:

  2. 四月 4, 2011

    用到的很少。

  3. 四月 3, 2011

    就用了统一的代码,没进行浏览器区别、

Leave a Reply

Allowed Tags - You may use these HTML tags and attributes in your comment.

<a href="" title=""> <abbr title=""> <acronym title=""> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <q cite=""> <strong>

 :wink:  :-|  :-x  :twisted:  :)  8-O  :(  :roll:  :-P  :oops:  :-o  :mrgreen:  :lol:  :idea:  :-D  :evil:  :cry:  8)  :arrow:  :-?  :?:  :!:

Note: You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS