how to rewrite a link

Discussion in 'Javascript' started by wpollans, Sep 18, 2007.

  1. wpollans

    wpollans Guest

    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
    button OR selecting "open in new tab" from the context menu - this is
    wpollans, Sep 18, 2007
    1. Advertisements

  2. Generally, yes.
    Is this for a Firefox extension?
    Because of the above, if it is not for an extension, you can not.

    Thomas 'PointedEars' Lahn, Sep 18, 2007
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.