Is there a way to add a rel="nofollow"
attribute to the window.open()
Javascript function? Or is that any way to have Google not follow a link created by Javascript or jQuery.
Update
Also, this will be a product for a client and I will not have access to their files. Any changes the robot.txt
or .htaccess
are off the table.
No, but Google probably doesn't give any weighting to URLs opened with
window.open
in the first place.nofollow
, despite its name doesn't ask search engines not to follow a link, only to not treat the link as an endorsement for ranking purposes.Use
robots.txt
if you want to ask search engines to stay away from URLs.Google can read javascript links
In HTML5, the
nofollow
link type may only be used witha
andarea
elements.Since you are already using javascript.. (and can not access the
robots.txt
or.htaccess
files), there is no reason why you couldn't use a normal (but hidden)<a href="http://exampe.com" rel="nofollow"
...etc(something that does support the attributes you seek, thus clearly and 'legally' indicating intention)
and use javascript to grab that URL (
href attribute
from thea
element) to pass it to yourwindow.open
function.. However, I do not know if google wil honor this method.Also (regarding your updated question), you can also set those directives using a meta header tag:
<meta name="robots" content="nofollow">
(and set endorsed links torel="follow"
).According to this excellent official google explanation (do give this a read or sit back and watch the talk..):
According to wikipedia.org/wiki/Nofollow:
PS: should anyone know (and be able to proof) that this wouldn't work.. leave a comment so future readers know that this workaround doesn't work as intended (and I'll amend my answer to reflect that).
You could put a disallow in your robots.txt