My contemplations and diurnal novelties are publicized here


Let say if you have following links present on you webpage

<href=https://hellowahab.wordpress.com>hellowahab</a>
<href=http://www.google.com>Google</a>

And you want favicons to be displayed with links then you can use following line of code

function getDomain(url) {
return url.match(/:\/\/(.[^/]+)/)[1];
}

$(“a[href^=’http’]”).each(function() {
$(this).css({
background“url(//favicon.yandex.net/favicon/” getDomain(this.href) +
“) left center no-repeat”,
“padding-left”“20px”
});
});

A bit of css

displayblocktext-decorationnonepadding5px; }

You can view demo here http://jsfiddle.net/hellowahab/bTQaa/

References:-

  1. http://jsfiddle.net/6Vg7t/20/
  2. http://css-tricks.com/favicons-next-to-external-links/?utm_source=dlvr.it&utm_medium=twitter
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: