image

I use this snippet sometimes when my automated scripts are unable to fetch the icon or favicon from a website. Here's a quick and simple way to find the icon or favicon on a website:

Open up your browser's console Command + Option + J on macOS or Ctrl + Shift + J on Windows and Linux.

Then paste the following code into the console:

var _icon = document.getElementsByTagName("link"); for (var i = 0; i < _icon.length; i++) { var link = _icon[i]; var rel = link.getAttribute("rel"); if (rel === "apple-touch-icon" || rel === "icon") { console.log(link.getAttribute("href")); } }

Here's what it returns on github.com:

https://github.githubassets.com/favicons/favicon-dark.svg https://github.githubassets.com/favicons/favicon.png

Hope you find this useful.

© 2024 Marko Bajlovic. Version 5.0.9.