Skip to content

Instantly share code, notes, and snippets.

@Victa
Created May 27, 2012 15:46
Show Gist options
  • Save Victa/2814842 to your computer and use it in GitHub Desktop.
Save Victa/2814842 to your computer and use it in GitHub Desktop.
display favicon in pseudo element
<a href=http://github.com>GitHub</a>
function getDomain(url) {
return url.match(/:\/\/(.[^/]+)/)[1];
}
$("a[href^='http']").each(function() {
$(this).css({
background: "url(http://www.google.com/s2/u/0/favicons?domain=" + getDomain(this.href) +
") left center no-repeat",
"padding-left": "20px"
});
});
@Victa
Copy link
Author

Victa commented May 27, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment