Page MenuHomePhabricator

Specify favicon with W3 standard rel="icon" instead of legacy "shortcut icon"
Closed, ResolvedPublicFeature

Description

The W3C recommends that icons be supported through the use of the following style of markup:
<link rel="icon" type="image/png" href="http://example.com/myicon.png">

MediaWiki is using the old "shortcut icon" style which is compatible with IE, but with which it is not possible to specify a PNG file (IE will then refuse to display a favicon at all).

It would be nice if MediaWiki had the option of supporting the new style, as IE will access /favicon.ico anyway if it does not see a "shortcut icon" link.


Version: unspecified
Severity: enhancement
URL: http://www.w3.org/2005/10/howto-favicon

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 10:32 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz17980.
bzimport added a subscriber: Unknown Object (MLST).

jadrian wrote:

As it is currently implemented, using rel="shortcut icon", Firefox 3 does not recognize favicons set with $wgFavicon. A quick-and-dirty fix is the following:

  • Add a new line in includes/DefaultSettings.php: $wgFaviconType = 'image/vnd.microsoft.icon';
  • Modify the line in includes/Skin.php that reads: $out->addLink( array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) ); to instead be $out->addLink( array( 'rel' => 'icon', 'type' => $wgFaviconType, 'href' => $wgFavicon ) );

In this case the user must specify $wgFaviconType as well as $wgFavicon in LocalSettings.php, e.g.:

$wgFavicon = '/images/myIcon.gif'
$wgFaviconType = 'image/gif';

Theoretically the type could be derived from the extension on the icon file itself, but that involves more code and also would break under the common case of the web designer renaming a non-ICO image (an animated GIF, for example) to have a .ico extension (see http://en.wikipedia.org/wiki/Favicon#Legacy).

Krinkle renamed this task from Favicon should support W3C preferred method to Specify favicon with W3 standard rel="icon" instead of legacy "shortcut icon".Jul 2 2015, 3:48 AM
Krinkle edited projects, added MediaWiki-User-Interface; removed MediaWiki-Parser.
Krinkle set Security to None.
Krinkle removed a subscriber: wikibugs-l-list.
Jdlrobson subscribed.

Is what was true in 2009 still true in 2020?

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 11:01 AM

According to https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types "The shortcut link type is often seen before icon, but this link type is non-conforming, ignored and web authors must not use it anymore. "

So sounds like we should do this.

Change 824720 had a related patch set uploaded (by R4356thwiki; author: R4356thwiki):

[mediawiki/core@master] OutputPage: replace legacy link type "shortcut icon" with standard

https://gerrit.wikimedia.org/r/824720

According to https://en.wikipedia.org/wiki/Favicon#How_to_use
This does break link based ico's on IE 9 and 10 (though still falling back to favicon.ico on root path of course), because in 9 and 10 you have to specify the type attribute for this to work apparently ?

I don't think this is a problem as IE11 is our current browser support cutoff, but just wanted to document it.

It's probably not worth it for a secondary feature, especially when it adds bytes to every page. IE 9 and 10 are roughly 0.07% of browser usage; on one of my own sites I see just 20 visits out of 986,000 using IE 9, while IE 10 does not show up (IE 11 was 1,182 - still just 0.1%).

I actually have IE 9 on Vista and I tried visiting Wikipedia and it just refused to connect at all, because it does not support TLS 1.2, which is the default now for most new OS versions. There is a way to enable this by installing updates for Server 2008 but this is unlikely to be done by most end-users. Of course, it is also a more regular update for Windows 7, but IE 11 was also offered there.

Change 824720 merged by jenkins-bot:

[mediawiki/core@master] OutputPage: replace legacy link type "shortcut icon" with standard

https://gerrit.wikimedia.org/r/824720

Wonderful! Thanks for the patch!