Link to home
Start Free TrialLog in
Avatar of atljarman
atljarman

asked on

JQuery replacement of closing hyperlink tag if http is in the href tag

I've been recently asked to modifiy how we redirect users from a site.  Currently we use a url variable on the asp .net page to redirect the user.  We validate and encode the data, but we were asked to make sure we know where we are directing the site.  Since it is virtually impossible to know that every site is valid when you allow a URL parameter to accept the target page, I need to come up with a different solution.

One thought would be to use javascript or Jquery to look at every link on the page and to determine if it includes http in the href.  If it does, then replace the closing tag with an image and some text that is hidden until hovered over.  I've got the code for the image and the hover, I just don't know how to implement the replacement of the closing </a> tag with the info we need to insert.

So for example, the desired action would be: <a href='http://www.google.com'>Google</a> would render to this:

<a href='http://www.google.com'>Google</a> <span class="dropt" title="Redirect Disclaimer"><img src='images/redirect.png' title='Redirect Disclaimer'/><span style="width:350px;">Text of the Disclaimer Here </span></span>


Here is the CSS to have the text show normally, and to appear when hovered over

span.dropt {/*border-bottom: thin dotted;*/ /*background: #ffeedd; */
      text-transform: None !important; float:right;}
span.dropt:hover {text-decoration: none; background: #ffffff; z-index: 6; }
span.dropt span {position: absolute; left: -9999px;
  margin: 20px 0 0 0px; padding: 3px 3px 3px 3px;
  border-style:solid; border-color:black; border-width:1px; z-index: 6;}
span.dropt:hover span {left: 7%; background: #ffffff;}
span.dropt:hover span.rightside {left: 45%; background: #ffffff;}
span.dropt span {position: absolute; left: -9999px;
  margin: 4px 0 0 0px; padding: 3px 3px 3px 3px;
  border-style:solid; border-color:black; border-width:1px;}
span.dropt:hover span {margin: 20px 0 0 170px; background: #ffffff; z-index:6;}
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of atljarman
atljarman

ASKER

Exactly what i needed.  Thank you.