Can I use nofollow in JavaScript

We have a question from Felipe in Argentina.

Felipe asks: What the nofollow equivalent for JavaScript links or redirections (now that you follow those too)?

Well, it turns out as part of following JavaScript, the team that implemented, calling JavaScript, also implemented the ability to add nofollow attribute on JavaScript links.

So in your JavaScript code you can specify that link, you know, as you’re building it is a--has the no follow attribute and then we won’t follow that.

And so that’s a very good way to do it.

The other way to do it that’s completely safe is, you know, for example, you can include some JavaScript that’s blocked by robots.txt if you’re doing those sort of links or, you know, you can use your JavaScript and then just have the link that gets generated, go through with your redirector, which itself is blocked in robots.txt.

So those are all some perfectly safe ways to make sure that  you don’t run into any problems whatsoever with JavaScript links being accidentally followed.