How Can I Check if a Link is DoFollow or NoFollow using Javascript?
There are many tools and addons out there to check these types of links but today, I am going to share with you a javascript code that label links according to their type. Just follow the steps below to check which link are nofollow and do follow.
- Open your browser console and copy-paste the code into the console.Hit enter.
- That’s it! All nofollow links and dofollow links will now be labelled accordingly in the website.
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = '.bd {border-radius:3px;color:white;background:black;padding:2px;font-size:10px;}.df{background:green}';
$$('head')[0].appendChild(style);
var urls=$$("a");for(url in urls){
if(urls[url].rel){urls[url].innerHTML+= " <span class='bd'> " + urls[url].rel + "</span>";}else{urls[url].innerHTML+="<span class='bd df'>dofollow</span>"}
}
0 comments:
Post a Comment