Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Appending A Data-Icon To An External Link With CSS3 Re: Appending A Data-Icon To An External Link With CSS3

#113044
JoniGiuro
Participant

with this snippet you get a list of all the links that don’t contain the same domain as the page you’re currently on:

var host = window.location.host;
$(‘a’).each(function(e){
var curLink = $(this);
var curLinkHref = curLink.attr(‘href’);
if(typeof curLinkHref != ‘undefined’){
if(curLinkHref.indexOf(host) == -1){
console.log(curLinkHref);
}
}
});