JSFiddle - React, Tailwind, and code Playground

by 1337

HTML

<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>").attr({
      "src": "https://getfavicon.appspot.com/" + $elink.attr("href") + "?defaulticon=bluepng",
      "width": "16px"
    }).css("vertical-align", "text-bottom")).before(" ");

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

    return;

  }


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

    favicognize($(this));

  });

});