how to rewrite a link

W

wpollans

I have sent this to the seleniumRC list - apologies to those who've
had to see it twice :)


Is it possible to rewrite a link? I want remove/ignore the onclick
handler and have it open in a new tab. I have no control over the
page source.
How can I do this with Javascript?

The links are of the form:

<a class="ccc" href="hhh" onclick="xxx">Some Text </a>

I'd like to rewrie it as:

<a class="ccc" href="hhh" target="_blank">Some Text</a>

and then send a 'click' to the rewritten link.

I'm trying to simulate the user clicking the link with the middle
mouse
button OR selecting "open in new tab" from the context menu - this is
FF-2.0.0.6.
 
T

Thomas 'PointedEars' Lahn

wpollans said:
Is it possible to rewrite a link?

Generally, yes.
I want remove/ignore the onclick
handler and have it open in a new tab.

Is this for a Firefox extension?
I have no control over the page source.
How can I do this with Javascript?

Because of the above, if it is not for an extension, you can not.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top