Return to Snippet

Revision: 57470
at May 28, 2012 10:49 by thewickedchemist


Initial Code
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"
    });    
});

Initial URL


Initial Description
Source: http://css-tricks.com/favicons-next-to-external-links/

Initial Title
Show Favicon for external Link with jQuery

Initial Tags
jquery

Initial Language
jQuery