You might be in a rush to gain backlinks from other sites so as to promote your own site. Gaining dofollow links (links that are crawled by search engines) is critical for website ranking. That’s why we shared the best sites that offer dofollow backlinks in our previous post. But how do we know which links are dofollow and which links are nofollow? There are a couple of ways to figure it out. But today, I am going to share with you a javascript code that labels links according to their type. All you have to do is paste the code into your browser console. The code automatically extracts links within the webpage and displays appropriate labels next to the links.
Javascript code snippet to check dofollow links
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>"} }
The Code in Action..
- 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.
Alternate method to check if link is dofollow
Sometimes websites use scripts to automatically make outbound links nofollow. In such situations the nofollow label trick may not work as expected. You can follow this alternate method to determine whether a link is dofollow or nofollow.
- Right click on the link and choose “Inspect Element”.
- Observe the corresponding HTML code and compare it against the below format.
The html code for nofollow links will look like this :
<a href=”LINK” rel=”nofollow”>TEXT</a>
If the term rel=”nofollow” is absent, then the links are dofollow.
The comments section must contain links so as to test whether they are dofollow or not.
pazarluk.com
nic article post