Does my favicon.ico have to be stored at the root of my domain? Or can I have my favicon stored on another domain?
Meaning, from www.example.com, is this valid?
<link rel="shortcut icon" href="http://MY-CDN.example.com/favicon.ico" />
What I want to do is serve my www.example.com favicon from my CDN. Is this okay? Any negatives I should know about about browser compatibility, performance, etc.
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".
A favicon (/ˈfæv. ɪˌkɒn/; short for favorite icon), also known as a shortcut icon, website icon, tab icon, URL icon, or bookmark icon, is a file containing one or more small icons, associated with a particular website or web page.
Modern browsers will show an icon to the left of the URL. This known as the 'favicon. ico' and is typically fetched from website.com/favicon.ico. Your browser will automatically request it when browsing to different sites.
Exporting the icon for Web use is straightforward. Choose File -> Save for Web & Devices and then choose PNG-24 from the Preset pop-up menu. Click Save, enter favicon. png as the file name, and once again click Save.
Yes. Just look at the source code of this page:
<link rel="shortcut icon" href="http://sstatic.net/so/favicon.ico">
However some user agents will still attempt to grab it at the root of your domain, to which you may want to setup a redirect to point there so you don't get 404s.
meder@meder-desktop:~$ curl -v http://stackoverflow.com/favicon.ico * About to connect() to stackoverflow.com port 80 (#0) * Trying 69.59.196.211... connected * Connected to stackoverflow.com (69.59.196.211) port 80 (#0) > GET /favicon.ico HTTP/1.1 > User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.10 > Host: stackoverflow.com > Accept: */* > < HTTP/1.1 302 Redirect < Content-Type: text/html; charset=UTF-8 < Location: http://sstatic.net/so/favicon.ico < Server: Microsoft-IIS/7.0 < Date: Tue, 05 Jan 2010 01:54:23 GMT < Content-Length: 156 < <head><title>Document Moved</title></head> * Connection #0 to host stackoverflow.com left intact * Closing connection #0 <body><h1>Object Moved</h1>This document may be found <a HREF="http://sstatic.net/so/favicon.ico">here</a></body>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With