[icon] 各種デバイスに最適なfaviconを指定する

記事内にプロモーションを含む場合があります。

Favicon cheat sheet

通常faviconというと、16×16 / 32×32のicoファイルを指定するのみですが、最近はスマートフォンなどの表示に合わせて複数のfaviconを指定する動きが見られます。

その際のfaviconは、それぞれに合わせたサイズのpngファイルを作成してヘッダーにタグを埋め込みます。

  • 16px: For general use in all browsers, could be displayed in the address bar, tabs or bookmarks views!
  • 24px: Pinned Site in Internet Explorer 9
  • 32px: New tab page in Internet Explorer, taskbar button in Windows 7+ and Safari’s ‘Read Later’ sidebar
  • 57px: Standard iOS home screen (iPod Touch, iPhone first generation to 3G)
  • 72px: iPad home screen icon
  • 96px: GoogleTV platform
  • 114px: iPhone 4+ home screen icon (twice the standard size for the retina display)
  • 128px: Chrome Web Store
  • 195px: Opera Speed Dial

<link rel="icon" sizes="16x16 32x32" href="favicon.ico">
<!--[if IE]><link rel="shortcut icon" href="favicon.ico"><![endif]-->

<!-- For iPad with high-resolution Retina display running iOS ≥ 7: -->
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="favicon-152.webp">

<!-- For iPad with high-resolution Retina display running iOS ≤ 6: -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="favicon-144.webp">

<!-- For iPhone with high-resolution Retina display running iOS ≥ 7: -->
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="favicon-120.webp">

<!-- For iPhone with high-resolution Retina display running iOS ≤ 6: -->
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="favicon-114.webp">

<!-- For first- and second-generation iPad: -->
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="favicon-72.webp">

<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
<link rel="apple-touch-icon-precomposed" href="favicon-57.webp">

[ audreyr/favicon-cheat-sheet · GitHub ]