favicon支援的圖片格式

來源:互聯網
上載者:User

為網站設定favicon有兩種方式:

1、網站根目錄下放置名為favicon.ico的圖片,瀏覽器就會自動擷取;

2、在頁面中通過<link rel="shortcut icon"  href="http://example.com/myicon.ico" />.

 

對於favicon來說,一般都是使用ico格式,不過對於根目錄的favicon圖片chrome、firefox、IE11等現代瀏覽器都支援PNG、GIF(無動畫)格式。對於通過link來設定的favicon格式,IE7+、現代瀏覽器都支援PNG、GIF格式,不過在IE7片效果會很差。

對於蘋果裝置,我們可以通過在head裡寫入<link rel="apple-touch-icon" href="somepath/image.png" />、<link rel="apple-touch-icon-precomposed" href="somepath/image.png" />來設定。

 

  Google Chrome Internet Explorer Firefox Opera Safari
<link rel="shortcut icon" href="http://example.com/myicon.ico" />
Yes[4] Yes[4][19] Yes[4] Yes[4] Yes
<link rel="icon" href="http://example.com/image.ico" />
Yes Yes (from IE 11)[20] Yes Yes Yes
<link rel="icon" type="image/vnd.microsoft.icon" href="http://example.com/image.ico" />
Yes Yes (from IE 9)[20] Yes Yes Yes
<link rel="icon" type="image/png" href="http://example.com/image.png" />
Yes Yes (from IE 11)[20] Yes Yes Yes
<link rel="icon" type="image/gif" href="http://example.com/image.gif" />
Yes Yes (from IE 11)[20] Yes Yes Yes
<link rel="icon" type="image/x-icon"href="http://example.com/image.ico"/>
Yes[4] Yes (from IE 9)[26] Yes[4] Yes[4] Yes
favicon.ico located in the website's root Yes Yes Optional[27] Optional[28] Yes
precedence: prefer root or (X)HTML linked version linked[22] linked[22] linked[22] ? ?

 

參考文檔:

http://en.wikipedia.org/wiki/Favicon

http://msdn.microsoft.com/en-us/library/ms537656(v=vs.85).aspx

http://stackoverflow.com/questions/1344122/favicon-png-vs-favicon-ico-why-should-i-use-pngs-instead-of-icos

http://www.webmasterworld.com/html/3701134.htm

http://blogs.msdn.com/b/ieinternals/archive/2013/09/08/internet-explorer-favicons-png-link-rel-icon-caching.aspx

http://blogs.msdn.com/b/jeffdav/archive/2007/03/01/why-doesn-t-the-favicon-for-my-site-appear-in-ie7.aspx

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.