I am trying to load the favicon of a different website using chrome favicon API chrome://favicon/size/16@3x/ when loading the page it shows a broken Icon.
Example code:
<img class="img-favicon" alt="icon" src="chrome://favicon/size/16@3x/https://replit.com/~"
Am I missing something what is it that I am doing wrong here? Any help, please.
Thank you so much in advance.
>Solution :
from my research, you cannot use the chrome favicon API outside of extensions/chrome itself.
If you are building a chrome extension, then you would have to add some custom permissions to the manifest.json described in this post: https://stackoverflow.com/a/48304708
If you were looking to grab favicons in a regular website, there exists some websites that offer APIs etc which you can use to get the favicon link, such as this: https://favicongrabber.com/service-api-reference