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.
You can use google favicon service, all you need to do is provide the domain name and google will give you the favicon.

This will return something like this.,SIZE,URL&url=

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