Avatar of Bl248
Bl248

asked on 

How to use the rel=nofollow in a onClick

I am getting a JS Error in IE but not in FF when I try to add a   rel='nofollow' to a URL in an onClick

<td> onclick="window.location.href='{site_url}' rel='nofollow'" onMouseOver="this.style.cursor='pointer';">Some Test</td>

I likely need to add the rel=nofollow to the href but how do I do that and still separate the parm from the URL location.
JavaScript

Avatar of undefined
Last Comment
Sinoj Sebastian
Avatar of stanscott2
stanscott2

I haven't used nofollow in my own work, but it was intended as an attribute of a link tag, so I would suggest you recast your work, like this:

<td><a rel='nofollow' href='#' onclick="window.location.href='{site_url}'">Some Test</a></td>

Using an A tag like this should make the onMouseOver event unnecessary.

Hope this helps,
Stan Scott
New York City
ASKER CERTIFIED SOLUTION
Avatar of Sinoj Sebastian
Sinoj Sebastian
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo