Search code examples
javascriptjqueryfaviconappendto

Why is favicon not visible


I have a script which allows to display favicons based on the url: Example

If you look at the example you will see two links, one linking to Google and the other to a popular dutch news website. As you can see the Google favicon is retrieved by the script while the other is not. How is this possible? What is causing this? If I go to the website I can see they do have a favicon. What can I change in the code to retrieve this favicon?


Solution

  • Because favicon for nu.nl is stored under http://www.nu.nl/images/favicon.ico

    Check out quick and dirty solution: http://jsbin.com/eselap/2/edit, which has hardcoded URLs. Ideally, you should request the page, parse it and find URL of favicon.