How to get a website's favicon URL with JavaScript?

I am building a google chrome new tab extension. Where users can bookmark their most used website or whatever they like. I want to show icons for saved websites. So how can I get favicon for each website using javascript?

You can try fetching the whole html with ajax then look for tag with rel=“icon” or rel=“shortcut icon” attribute.
Or
You can use google favicon service, all you need to do is provide the domain name and google will give you the favicon.

https://s2.googleusercontent.com/s2/favicons?domain=https://www.how7o.com

This will return something like this.

https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://www.how7o.com&size=16

You can use both link, but in second link you can tell the specify the favicon size.