From 825dae3febe3857cb046fea13642e91cb7f09956 Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Tue, 3 Feb 2015 16:06:35 +0100 Subject: [PATCH] Remove other icons in Chrome to make it work --- favico.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/favico.js b/favico.js index 7eef1e7..0f4c2c7 100644 --- a/favico.js +++ b/favico.js @@ -459,12 +459,19 @@ //get link element var getLink = function() { var link = document.getElementsByTagName('head')[0].getElementsByTagName('link'); + var result = false; for (var l = link.length, i = (l - 1); i >= 0; i--) { if ((/(^|\s)icon(\s|$)/i).test(link[i].getAttribute('rel'))) { - return link[i]; + if(!result) { + result = link[i]; + } else { + if(_browser.chrome) { + link[i].parentNode.removeChild(link[i]); + } + } } } - return false; + return result; }; if (_opt.element) { elm = _opt.element; @@ -842,4 +849,3 @@ } })(); -