Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any problems with favicons in a subfolder?

Could there be any problems moving favicons and apple touch icons to a subfolder? Like:

<link rel="shortcut icon" href="/images/favicons/favicon.ico">
<link rel="apple-touch-icon" href="/images/favicons/apple-touch-icon.png">
like image 399
Tony Camaiani Avatar asked Mar 11 '11 12:03

Tony Camaiani


People also ask

Can I put favicons in a folder?

To add a favicon to your website, either save your favicon image to the root directory of your webserver, or create a folder in the root directory called images, and save your favicon image in this folder. A common name for a favicon image is "favicon.ico".

Where should I store favicon?

If you only want one favicon for your entire domain, simply save the favicon. ico file to the root folder of your site. When uploaded, it must be accessible from http://www.yourdomain.com/favicon.ico . As soon as you upload the file, your browser should start displaying the icon for all pages on your site.

Do favicons need to be in Roots?

Please note: Your favicon does not have to be placed in the root directory of your site — it just usually is. If you saved it in another location, just make sure the href attribute is accurate. So if you saved it to a subfolder named “images” then you'd type in <href="images/favicon. png">.

Why is my favicon not showing up?

Your browser has cached your site as one without a favicon When you add a favicon to your site, it may not show up since your browser has 'saved' your site as one without a favicon. You need to clear the cache in your browser or use a different browser.


1 Answers

Yes, some browsers start downloading /favicon.ico at the same time they start downloading HTML document. If there's no file you'll get an extra 404 in your server log and the browser will have to make an extra HTTP request when it recognizes the icon is elsewhere.

A quote from Yahoo's Best Practices for Speeding Up Your Web Site:

The favicon.ico is an image that stays in the root of your server. It's a necessary evil because even if you don't care about it the browser will still request it, so it's better not to respond with a 404 Not Found. Also since it's on the same server, cookies are sent every time it's requested. This image also interferes with the download sequence, for example in IE when you request extra components in the onload, the favicon will be downloaded before these extra components.

like image 200
Alexey Lebedev Avatar answered Sep 30 '22 20:09

Alexey Lebedev