w3schools index html favicon

w3schools - index html favicon



HTML: ¿puede mi favicon estar en un CDN en lugar de/favicon.ico? (2)

¿Mi archivo favicon.ico debe almacenarse en la raíz de mi dominio? ¿O puedo tener mi favicon almacenado en otro dominio?

Es decir, de www.example.com , ¿es esto válido?

<link rel="shortcut icon" href="http://MY-CDN.example.com/favicon.ico" />

Lo que quiero hacer es servir mi favicon www.example.com desde mi CDN. ¿Esta bien? Cualquier aspecto negativo que deba saber sobre la compatibilidad del navegador, el rendimiento, etc.


Puede hacerlo fácilmente apuntando el archivo en su encabezado al CDN. Como:

<link rel="shortcut icon" href="//cdn.perfmatters.io/favicon.ico" type="image/x-icon" />

Para obtener más detalles en profundidad, me gustaría ver el siguiente tutorial, tiene todo lo que necesita sobre cómo alojar su favicon en su CDN en su lugar. https://www.keycdn.com/blog/make-a-favicon/

De ninguna manera es la optimización más importante que puede hacer, pero una vez más, todo cuenta y se suma. Especialmente si vas a una única conexión HTTP / 2 .


Sí. Solo mira el código fuente de esta página:

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

Sin embargo, algunos agentes de usuario aún intentarán capturarlo en la raíz de su dominio, a la que le gustaría configurar una redirección para que apunte allí para que no obtenga 404s.

meder@meder-desktop:~$ curl -v http://.com/favicon.ico * About to connect() to .com port 80 (#0) * Trying 69.59.196.211... connected * Connected to .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: .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 .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>