/ Published in: jQuery

Source: http://css-tricks.com/favicons-next-to-external-links/
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function getDomain(url) { return url.match(/:\/\/(.[^/]+)/)[1]; } $("a[href^='http']").each(function() { $(this).css({ background: "url(http://favicon.yandex.net/favicon/" + getDomain(this.href) + ") left center no-repeat", "padding-left": "20px" }); });
Comments
