Skip to content

Instantly share code, notes, and snippets.

@Lytol
Created July 4, 2009 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lytol/140481 to your computer and use it in GitHub Desktop.
Save Lytol/140481 to your computer and use it in GitHub Desktop.
$(document).ready(function(){
// Add a favicon to all links with class name favicon
//
$("a.favicon").each(function() {
this.style.paddingLeft = '25px';
this.style.background = 'transparent url(' + faviconFromLink(this) + ') no-repeat top left';
});
});
function faviconFromLink(link) {
var googleFaviconBaseURL = "http://www.google.com/s2/favicons?domain=";
return (googleFaviconBaseURL + link.hostname);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment