htmlcssiossafarifavicon

iPhone storing website favicon even though it's been updated and cache/history is cleared


The icon that displays on my iPhone XS (Safari) is incorrect. If I bookmark the site or add to favourites the new/correct image is displayed but if I click the 'tab' icon, where you see all open tabs it's a very old favicon.

The image that is displayed isn't my the hosting. I've even changed hosting provider recently so everything is fresh. I can only assume the previous icon is cached from the old site on my phone - but the same domain name.

I have cleared Safari's cache and in "Advanced" the "Website Data" but no matter what I do the icon won't change. I've tried adding ?v=2 to the URL to try and force a fresh download but no matter what, it won't display the image I'm specifying in the head.

I load my icons like this:

<link rel="apple-touch-icon" href="icon.png" sizes="192x192">
<link rel="shortcut icon" href="favicon.png" sizes="32x32">

Any ideas? The only thing I can think of is the device itself is storing aspects on websites but outside of Safari and the cache?


Solution

  • Interesting, with further research I found out it's a known issue for Safari iOS/iPadOS to cache favicons in a hidden location.

    Safari has extremely aggressive favicon cache. I've seen it happen multiple times on large production websites that the favicon doesn't update for months.

    source

    It seems like macOS has a folder that stores that data, but unfortunately that location is not accessible via mobile (to my knowledge).

    Without giving you a fix for you issue, I hope that my answer might bring light on this cache issue, as I'm experiencing the same problem on my iPhone 13 Pro 15.6.1.