From 58c19f1c4d816b3812f68bb704b1e93f9dc577fb Mon Sep 17 00:00:00 2001 From: Ivan Grachev Date: Mon, 15 Aug 2022 17:36:56 +0300 Subject: [PATCH] Find favicon once --- Safari Shared/Resources/content.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Safari Shared/Resources/content.js b/Safari Shared/Resources/content.js index e621a7f2..6bab7052 100644 --- a/Safari Shared/Resources/content.js +++ b/Safari Shared/Resources/content.js @@ -132,11 +132,16 @@ window.addEventListener("message", function(event) { }); var getFavicon = function() { + if (document.favicon) { + return document.favicon; + } + var nodeList = document.getElementsByTagName("link"); for (var i = 0; i < nodeList.length; i++) { if ((nodeList[i].getAttribute("rel") == "apple-touch-icon") || (nodeList[i].getAttribute("rel") == "icon") || (nodeList[i].getAttribute("rel") == "shortcut icon")) { const favicon = nodeList[i].getAttribute("href"); if (!favicon.endsWith("svg")) { + document.favicon = favicon; return favicon; } }