Reputation: 499
I´m trying to add nofollow
to a link with an existing rel
attribute that triggers an iframe
popup.
Here is the link I am trying to alter:
<a class="modal" rel="{handler: 'iframe', size: {x: 700, y: 550}}"
title="Email" href="/myurl.html">link text...</a>
The question is, how do I add nofollow
to the rel
attribute without messing up the popup?
I have tried this, but it comprimizes the popup release:
<a class="modal" rel="nofollow {handler: 'iframe', size: {x: 700, y: 550}}"
title="Email" href="/myurl.html">link text...</a>
Upvotes: 1
Views: 705
Reputation: 6294
you can try having the links with rel="nofollow"
so search engines can read it, and then you can change that value onclick. like this
<a id="mylink" rel="nofollow" onclick="return changerel(this);" href="#">link</a>
<script type="text/javascript">
function changerel(el)
{
var myreplace = "{handler: 'iframe', size: {x: 700, y: 550}}";
alert('rel before:'+el.rel)
el.setAttribute("rel", myreplace);
alert('rel after:'+el.rel);
if (el.rel != myreplace)
{
el.onclick();
}
}
</script>
see it in action here http://jsfiddle.net/5Basb/4/
Upvotes: 2
Reputation: 5915
Having a JavaScript object in the rel
attribute is non-standard, so is nofollow
. However, the nofollow
attribute value would comply with valid link types. What library or environment uses the information in your rel
attribute? You could store it in a data
attribute, so the rel
can be used for its original intent.
Upvotes: 1