I am dealing with this mess of icons in OS X Yosemite Safari's Favorites view:

enter image description here

Note how nice and easy it is to visually locate the IPython and AWS icons: I would like to have similar icons displayed for my other favorite go-to sites, most of which are hosted off of various subdirectories of a single private web server (call it "foo.lan").

IPython is accessed via the IP address for "foo.lan". I got it to work for IPython using the standard method, i.e. including the following in the HTML header:

<link rel="apple-touch-icon" href=.../>
<meta name="apple-mobile-web-app-capable" content="yes" />

And when I investigated why it worked, it appears the image is cached by Safari in ~/Library/Safari/Touch Icons/ as "92AE91400BBEF8B1D9854D7151202EED.png": "92..." being the MD5 hash of the string "", i.e. the domain I'm using to access IPython.

The problem is that this method of mapping icons to webpages assumes that there will only be one icon per website, not one icon per webpage. In my case, there are multiple webpages, accessed off of one website i.e. "foo.lan", for each of which I would like a separate icon to display in Favorites.

I tried manually copying an icon into .../Touch Icons, renaming it to the MD5 hash of the full path to the webpage, and editing the cache plist accordingly: of course this long shot did not work.

Is there any way to trick Safari into associating icons with specific pages within a single site, instead of just one-icon-per-site? I wonder if this is simply something that needs to be changed in Safari, as iOS is perfectly capable of caching web app icons and displaying them correctly on the home screen. Such a display capability for OS X Safari would be very useful if it doesn't already exist.

One Solution

User "root" suggested add subdomains that map to each "service portal" running on the website. So commands.foo.lan, books.foo.lan, and so on. Some simple trickeration with DNS aliasing (no web server tinkering required, fortunately) confirms that this enables per-page icons as desired (further confirming the diagnosis of the problem). This seems sort of like hammering in a nail using a screwdriver, though, and wish there was a prettier way to get this behavior.

Even after rearranging all of your DNS to enable this feature, however, you still have to deal with Safari's extreme flakiness wrt actually pulling the pictures from the web server in the first place; this is a problem also seen with mobile Safari's unpredictable failures to preserve icons for your webApps and the subsequent merriment of diagnosing the problem. Fortunately in a non-(jailbroken-)iOS environment it is possible to force the matter by jumping into CacheSettings.plist, locating the record for the site you whose icon you want to edit, manually setting the TouchIconInCache boolean to "YES", and then - wait for it - manually calculating the MD5 hash of the string of your domain name, changing your icon name to that hash, and copying it into the "Touch Icons" folder as follows:

enter image description here

Once you have completely reorganized DNS in your LAN, and have calculated MD5 hashes of the domain names you want Safari to display icons for, finally you can quickly access icons for your favorite webpages, regardless of whether they are hosted across separate or on the same domain.

  • The only thing I can come up with it is that as it is your private web server you could configure apache to give each web app its own sub-domain. – root Nov 9 '14 at 20:02
  • right - and I may do that, but that will greatly complicate certificate management (everything is going over HTTPS), and seems like overkill. Maybe Apple can add another meta tag to allow for per-page marking??? EDIT: I could do wildcard certificates... still seems like more trouble than necessary though. – bjsdaiyu Nov 9 '14 at 21:38
  • I'm having this same problem, but on iOS, where it's not as easily rectified. Did you ever find a more elegant solution? – Alex Beals Jun 22 '18 at 16:39

You must log in to answer this question.

Browse other questions tagged .