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 c
Google can read javascript links
In HTML5, the nofollow link type may only be used with a
and area
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 the a
element) to pass it to your window.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 to rel="follow"
).
According to this excellent official google explanation (do give this a read or sit back and watch the talk..):
How does Google handle nofollowed links?
In general, we don't follow them. This means that Google does not transfer PageRank or anchor text across these links. Essentially, using nofollow causes us to drop the target links from our overall graph of the web. However, the target pages may still appear in our index if other sites link to them without using nofollow, or if the URLs are submitted to Google in a Sitemap. Also, it's important to note that other search engines may handle nofollow in slightly different ways.
According to wikipedia.org/wiki/Nofollow:
- Google states that their engine takes "nofollow" literally and does not "follow" the link at all. However, experiments conducted by SEOs show conflicting results. These studies reveal that Google does follow the link, but it does not index the linked-to page, though it might be in Google's index for other reasons (such as other, non-nofollow links that point to the page).
- Yahoo! follows it, but excludes it from their ranking calculation.
- Bing also follows it, but excludes it from their ranking calculation.
- Ask.com also respects the attribute.
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).
Is there a way to add a rel="nofollow" attribute to the window.open() Javascript function?
No, but Google probably doesn't give any weighting to URLs opened with window.open
in the first place.
Or is that any way to have Google not follow a link created by Javascript or jQuery.
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.
You could put a disallow in your robots.txt