JSFiddle - React, Tailwind, and code Playground
by kachibito
HTML
<a href="http://kachibito.net/">kachibito</a><br />
<a href="http://www.facebook.com/">facebook</a><br />
<a href="http://twitter.com/">twitter</a><br />
<a href="http://www.youtube.com/">youtube</a><br />
<a href="http://www.flickr.com/">flickr</a><br />
<a href="http://b.hatena.ne.jp/">hatena</a><br />
CSS
img{width:15px;height:15px;}
a{text-decoration:none;color:green;margin-bottom:5px;display:inline-block;}
JavaScript
$('a[href^="http://"]').filter(function() {
return this.hostname && this.hostname !== location.hostname;
}).each(function(){
var l = $(this);
var fu =
l.attr('href').replace(/^(http:\/\/[^\/]+).*$/, '$1') + '/favicon.ico';
var fi = $('<img src="favicon.png" alt="favicon" />')['prependTo'](l);
var e = new Image();
e.src = fu;
if (e.complete) fi.attr('src', fu);
else e.onload = function(){
fi.attr('src', fu);
};
});