public
Last active

  • Download Gist
README.md
Markdown

How to Fix Unread Favicon in GMail for Chrome

  • Ensure Labs => Unread Message Icon feature enabled
  • Install "TamperMonkey" chrome plugin
  • Add the javascript included in this gist (fix_gmail_unread_favicon.js)

Thanks to Bertrand Schneider for the code snippet and fix.

Why did the favicon break?

It looks like there was a regression that causes two favicon link elements to be generated in the GMail markup, causing only the first to take precedence for the page (the default favicon) and the smart favicon with the unread count not to be shown.

Work-around for old GMail (on Google Apps domain)

  • Change the match string in the JavaScript only to match your public gmail account, for example https://mail.google.com/mail/u/0/* if your public GMail is your first logged in google account.
fix_gmail_unread_favicon.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// ==UserScript==
// @name Fix GMail Unread Favicon
// @version 0.1
// @description Fixes GMail favicon to include unread message count properly
// @match https://mail.google.com/*
// @copyright 2012+, Bertrand Schneider
// ==/UserScript==
var favicon = undefined;
var nodeList = document.getElementsByTagName("link");
for (var i = 0; i < nodeList.length; i++)
{
if((nodeList[i].getAttribute("rel") == "shortcut icon"))
{
element = nodeList[i];
element.parentNode.removeChild(element);
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.