Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML: can my favicon be on a CDN instead of /favicon.ico?

Tags:

html

favicon

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.

like image 805
TeddyR Avatar asked Jan 05 '10 01:01

TeddyR


People also ask

Where should favicon ICO be?

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".

Should favicon be called favicon?

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.

Is favicon an ICO?

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.

What should a favicon be saved as?

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.


1 Answers

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> 
like image 101
meder omuraliev Avatar answered Sep 24 '22 12:09

meder omuraliev