Skip to content

Instantly share code, notes, and snippets.

@Balya
Forked from smonteverdi/gist:2822016
Last active December 19, 2016 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Balya/c29a7620efdebd5470d820f241c6090b to your computer and use it in GitHub Desktop.
Save Balya/c29a7620efdebd5470d820f241c6090b to your computer and use it in GitHub Desktop.
jQuery: Display favicon next to external link
jQuery(document).ready(function() {
jQuery("article a[href*='//']:not([href*='" + document.location.hostname + "']):not(:has(*))").each(function() {
jQuery(this).css({
background: "url(http://www.google.com/s2/favicons?domain=" + this.hostname + ") left center no-repeat",
"padding-left": "22px"
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment