JSFiddle - React, Tailwind, and code Playground

by 1337

HTML

<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<div class="favicons">
<a href="http://www.google.com/" class="external" rel="nofollow" target="_blank">google.com</a>
</div>

JavaScript

jQuery(function ($) {
    
function favicognize($elink) {

    $elink.before($("<img width=\"16px\">").attr("src", "https://getfavicon.appspot.com/" + $elink.attr("href") + "?defaulticon=bluepng").css("vertical-align", "text-bottom")).before(" ");

//    $elink.prev("img").attr("width", "16px");

    return;

  }


  $("div.favicons a.external").each(function() {

    favicognize($(this));

  });

});