Why is the browser making multiple favicon calls? - html

I have the following in my index.html for getting favicon:
<link rel="icon" href="https://cdn-xyz.favicon.png" type="image/x-icon" />
<link rel="apple-touch-icon" sizes="192x192" href="https://cdn-xyz.favicon-192.png" type="image/x-icon" />
The first link is to a 48x48 pixel image as I want the browser to use that make the network call faster.
The second link is to a 192x192 pixel in cases when the larger size image is needed (for example on iOS add to home screen).
The problem is that both these images are fetched at the start by Firefox (other browsers don't have this issue). Why is this and what can I do to prevent this?

Looking at Firefox DevTools Network tab, both favicon requests were initiated by FaviconLoader.jsm. Looking at the code, it seems that loadIcons() loads a rich icon and a tab icon, chosen by selectIcons.
The way selectIcons chooses the best tab icon and rich icon is the following:
The tab icon is the svg icon, the smallest icon larger than 16x16 (for normal dpi), or the ico file, in order of ascending preference.
The rich icon is the largest rich icon (ie. larger than 96x96).
In your case, the 48px icon is the tab icon, and the 192px icon is the rich icon, thus the two requests.
The rich icon is probably used by Firefox for the top sites icons on the new tab page.
I don't think you can prevent this, but favicons are usually fetched by the browser after the page has loaded, so it shouldn't affect your website's performance.

Related

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?
I had the same problem and found the following.... use the "+" in safari to go to your START PAGE, then delete ALL instances of that page, go to edit at the bottom and turn off favorites, then turn it back on. The favicon updated.
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
Kindest regards

Favicon squished for browser only

Not filling entire icon space.
website
The favicon on my website is squished. It only happens on browsers. It doesn't happen with the safari mask icon, windows 8/10 Tile icon, Android (Launcher) shortcut icon, or the iOS safari shortcut icon. Is there a way i can fix this?
this issue may appear when your computer browser is cached ...
click on CNTROL + F5 on key bored to make hard refresh and add this code to tag on your HTML PAGE assuming that your icon image on folder and img/icon/(your favicon name)
please resize your favicon to heiht : 16px and width 16px and paste the below code
<link rel="shortcut icon" type="image/x-icon" href="img/icon/favicon.png">
hope this works for you
See my annotations in this image from invoking iOS’s Add to Homescreen option https://i.stack.imgur.com/XNoVG.jpg
My notes simply illustrate what Ahmed already stated: you need to spend more time reworking the pixels in your favicon. Yes, it’s all about anti-aliasing and pushing pixels.

How to show my site icon the way I want?

I have no control over my site presentation icon. Browsers choose to show the menu button that I have in my header section. Or, when saved in bookmarks, my site is automatically represented by an ugly yellow square with a letter inside. Please show me the code I should write to have a picture/graphics of my own choice that will represent my site in browsers (when sharing the link, when saving to bookmarks). Please do not write about favicon code for tabs, this is not the question here. Thank you!
Diffrant browsers and platforms use diffrant resolutions/aspect ratio's and code for the icon image.
The reason why you get a stock browser icon and not your logo is probably due to you having a incorrect aspect ratio of your image and the wrong code for the platform your targeting. Please be more specific about what platform your targeting your icon for and I'm sure people can help more. But in any case I'll post the resolutions and code I know below.
16x16: browser favicon
32x32: taskbar shortcut icon
96x96: desktop shortcut icon (and Google/android TV)
128x128: Chrome Webstore icon
196x196: Android Chrome icon
228x228: Opera Coast icon
Here's a example of the code for browser favicon, taskbar and shortcut
<link rel="icon" type="image/png" href="https://yourwebsite.com/favicon-16x16.png" sizes="16x16">
Apple IOS (touch devides)
120x120: iPhone Retina (iOS 7)
180x180: iPhone 6 Plus (iOS 8+)
152x152: iPad Retina (iOS 7)
167x167: iPad Pro (iOS 8+)
Here's a example of the code targeting apple devices
<link rel="apple-touch-icon" sizes="180x180" href="yourLogo.png">
Windows Metro
Due to how the tile system works in microsoft metro UI used in windows you need the following resolutions 70x70, 270x270, 310x310 and 310x150
Code example, keep in mind that the following code should be posted in the root directory of your website with the name browserconfig.xml!!!
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="https://cdn.yourwebsite.com/mstile-70x70.png"/>
<square150x150logo src="https://cdn.yourwebsite.com/mstile-270x270.png"/>
<square310x310logo src="https://cdn.yourwebsite.com/mstile-310x310.png"/>
<wide310x150logo src="https://cdn.yourwebsite.com/mstile-310x150.png"/>
<TileColor>#2b5797</TileColor>
</tile>
</msapplication>
</browserconfig>
Set an og:image in the of your HTML like this:
<meta property="og:image" content="http://yoursite.com/ogp.jpg" />
This is part of the Open Graph Protocol, used by most sites.
more info on structuring og:image here

Apple icon not showing up in bookmark

I used the following:
<link href="https://www.domain.com/apple-touch-icon.png" rel="apple-touch-icon" />
This works for adding a shortcut to the homescreen. However, when bookmarking the page, it defaults to the little compass icon. Is there an extra step to do this?
To clarify, the icon shows up everywhere, (i.e titlebar, i.e. favorites, etc), except the iphone bookmark.
Not difficult, you need a favicon.ico file and ftp that up to the site.
Have a look here http://www.favicon.cc/, or look for favicon.ico in google.
They are very easy to make using photoshop or preview.

Favicon size in Google Chrome bookmarks

Does anybody know how to show a larger favicon in the Google Chrome bookmarks on my mobiles devices, like this fd-favicon? (image)
My website supports the favicon sizes:
16x16
72x72
114x114
120x120
144x144
152x152
Image:
http://oi60.tinypic.com/1yl6ag.jpg
Thanks.
Google recommends to use the Apple touch icon and a 196x196 PNG icon. If you use both, Chrome will almost always use the Apple touch icon.
In other words, your HTML code should contain something like:
<link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png">
See Apple specs for more information on the Apple touch icon.
You can generate all pictures and HTML code with this favicon generator. Full disclosure: I'm the author of this site.