views:

168

answers:

1

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.

+5  A: 

Yes. Just look at the source code of this page:

<link rel="shortcut icon" href="http://sstatic.net/so/favicon.ico"&gt;

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"&gt;here&lt;/a&gt;&lt;/body&gt;
meder
'some user agents' pretty much means IE versions 6 and below so this issue is becoming obsolete,
SpliFF
That's still a large majority of the world, so I don't think it's obsolete.
meder