javascript - Detect favicon not found - Google S2 Favicon -
if google s2 favicon service can't find favicon of website, returns default image. want know favicon not found can show other default image (on server), or switch favicon service (like g.etfv.co). know google s2 isn't nice.
i need in browser html/javascript solutions nice. have root url, e.g. www.google.com or www.facebook.com.
final question : how detect favicon not found google s2, or should switch favicon provider?
thanks in advance!
i wrote code (as wp plugin)
it checks each of favicon providers if default image provided. if so: jump next provider. if none of providers give me image curl myself , e.g. follow redirects , scan 404's favicon.
i check on datastring returned: if equal "empty image" provided specific provider, uhm... empty image (and yes if provider changes default image need change variable of empty-image-string)
e.g. google (md5):
private $_default = 'b8a0bf372c762e966cc99ede8682bc71'; full source code (gpl): http://plugins.svn.wordpress.org/wp-favicons/trunk/ (under /includes/server find plugins http requests , parse images etc...)
i decided implement in plugin way:
- plugins add providers (sources)
- plugins further operate on images (e.g. rescale, etc...)
- plugins provide default favicons if none found e.g. gravatars
- plugins perform caching
it implemented server , client, can install server part , calls server via http xml requests: send piece of text , text returned hrefs replaced hrefs + favicon in front of it.
Comments
Post a Comment