Skip to content

Instantly share code, notes, and snippets.

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 omidnasri/1d894550c5d582ffa8c0e64d8a5e73f6 to your computer and use it in GitHub Desktop.
Save omidnasri/1d894550c5d582ffa8c0e64d8a5e73f6 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