Skip to content

Require an apple touch icon #198

@WuglyakBolgoink

Description

@WuglyakBolgoink

Why is this important? (see https://sonarwhal.com/docs/user-guide/rules/rule-apple-touch-icons/)

Safari for iOS supports since iOS 1.1.3 a way for developers to specify the image (known as touch icon) that will be used when the user adds the web site/app to the homescreen.

Nowadays there is a better and standard way of specifying images that browsers can use using the web app manifest file, but unfortunately, Safari for iOS doesn’t support that (yet).

Furthermore, over the years, the requirements for the size of the touch icon have changed quite a bit:

  • 57×57px – iPhone with @1x display and iPod Touch
  • 72×72px – iPad and iPad mini with @1x display running iOS ≤ 6
  • 76×76px – iPad and iPad mini with @1x display running iOS ≥ 7
  • 114×114px – iPhone with @2x display running iOS ≤ 6
  • 120×120px – iPhone with @2x and @3x display running iOS ≥ 7
  • 144×144px – iPad and iPad mini with @2x display running iOS ≤ 6
  • 152×152px – iPad and iPad mini with @2x display running iOS 7
  • 180×180px – iPad and iPad mini with @2x display running iOS 8+
    and developers tend to include all these sizes, but there is no need to do that. Declaring just one 180×180px PNG image, e.g.:
<link rel="apple-touch-icon" href="apple-touch-icon.png">

in the <head> of the page is enough.

Including all the different sizes is actually not even recommended as:

It will just increase the size of the pages with very little to no real benefit (most users will probably not add the site to their homescreens).

Most sizes will probably never be used as iOS devices get upgraded pretty quickly, so most iOS users will be on the latest 2 versions of iOS, and using newer devices.

The 180×180px image, if needed, will be automatically down scaled by Safari, and the result of the scaling is generally ok.

The only downside to using one icon is that some users will load a larger image, while a much smaller file would have worked just as well. But the chance of that happening decreases with every day as users upgrade their devices and their iOS version.


At this moment we produce following files:

<link rel="apple-touch-icon" sizes="57x57" href="/assets/favicons/apple-touch-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="/assets/favicons/apple-touch-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/assets/favicons/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="/assets/favicons/apple-touch-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/assets/favicons/apple-touch-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="/assets/favicons/apple-touch-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="/assets/favicons/apple-touch-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="/assets/favicons/apple-touch-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="/assets/favicons/apple-touch-icon-180x180.png">

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions