Is it possible to retrieve the favicon of a url doing javascript client side scripting?
I'm guessing I would have to use JSONP for this but I don't know of any service that would let me do this. Does anyone know of anywa开发者_StackOverflow社区y of doing this?
It's certainly possible. First check if the favicon is declared in a meta tag and extract the URL. If there isn't a meta tag use the URL /favicon.ico. Then use new Image(URL)
to manipulate/test the file.
It is not exactly what you asked, but the easiest way to retrieve a favicon is by using a servervice provided by Google:
http://www.google.com/s2/favicons?domain=en.wikipedia.org
Just edit it to point to the right domain.
精彩评论