SVG favicon Mozilla fix

SVG favicon doesn't appear in Firefox prior to 41 version Motty Katan(c) 15-09-2015 last updated 15-09-2015

当前为 2015-09-15 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name           SVG favicon Mozilla fix
// @name:fr        SVG favicon Mozilla correction
// @description    SVG favicon doesn't appear in Firefox prior to 41 version Motty Katan(c) 15-09-2015 last updated 15-09-2015
// @description:fr    On ne voit pas des SVG favicons dans les versions de Firefox qui précèdaient 41 Motty Katan(c) 15-09-2015 dernière mise à jour 15-09-2015
// @version 1.0.1
// @include       *
// @namespace https://greasyfork.org/users/14985
// ==/UserScript==
(function(){
	var isFirefox = navigator.userAgent.match(/Firefox\/(\d\d\.\d)/);
	if (isFirefox && isFirefox[1]<41){
		var oChildren = document.head.children;
		var i = -1;
		while (++i < oChildren.length && (oChildren[i].tagName != 'LINK' || (!oChildren[i].getAttribute('rel') || oChildren[i].getAttribute('rel').indexOf("icon")===-1) || (!oChildren[i].getAttribute('href') || oChildren[i].getAttribute('href').substr(-3).toLowerCase()=="svg") )){}	
		if (typeof(oChildren[i])!="undefined"){
			//refresh it since a svg file can delete previous icon
			oChildren[i].href = oChildren[i].href;
		}	
	}
})();