diff --git a/src/applinks.js b/src/applinks.js index 53098b34f..b7f48549e 100644 --- a/src/applinks.js +++ b/src/applinks.js @@ -88,9 +88,9 @@ async function detectMetaInfo(applink) { if (!applink.icon) { let favicon = ''; if (dom.window.document.querySelector('link[rel="apple-touch-icon"]')) favicon = dom.window.document.querySelector('link[rel="apple-touch-icon"]').href ; - if (!favicon.endsWith('.png') && dom.window.document.querySelector('meta[name="msapplication-TileImage"]')) favicon = dom.window.document.querySelector('meta[name="msapplication-TileImage"]').content ; - if (!favicon.endsWith('.png') && dom.window.document.querySelector('link[rel="shortcut icon"]')) favicon = dom.window.document.querySelector('link[rel="shortcut icon"]').href ; - if (!favicon.endsWith('.png') && dom.window.document.querySelector('link[rel="icon"]')) { + if (!favicon && dom.window.document.querySelector('meta[name="msapplication-TileImage"]')) favicon = dom.window.document.querySelector('meta[name="msapplication-TileImage"]').content ; + if (!favicon && dom.window.document.querySelector('link[rel="shortcut icon"]')) favicon = dom.window.document.querySelector('link[rel="shortcut icon"]').href ; + if (!favicon && dom.window.document.querySelector('link[rel="icon"]')) { let iconElements = dom.window.document.querySelectorAll('link[rel="icon"]'); if (iconElements.length) { favicon = iconElements[0].href; // choose first one for a start @@ -104,7 +104,7 @@ async function detectMetaInfo(applink) { if (iconElements.length) favicon = iconElements[0].href; } } - if (!favicon.endsWith('.png') && dom.window.document.querySelector('meta[itemprop="image"]')) favicon = dom.window.document.querySelector('meta[itemprop="image"]').content; + if (!favicon && dom.window.document.querySelector('meta[itemprop="image"]')) favicon = dom.window.document.querySelector('meta[itemprop="image"]').content; if (favicon) { favicon = new URL(favicon, redirectUri || applink.upstreamUri).toString();