redirecting all hyperlinks?

Discussion in 'JavaScript' started by feivi18, Apr 24, 2008.

  1. #1
    Hi everyone.

    1. I have a page which consists of two iframes. The first one displays an external site (so I can't change the source code), and I'm looking for a way that any link clicked on that iframe will open in the second iframe. Is there any script which can be included in the iframe which will make all links open in iframe 2? Failing that, can anyone think of a way to do this?

    2. Is there any script which allows one to DRAG a link between iframes?

    TIA!
     
    feivi18, Apr 24, 2008 IP
  2. eTechDude.com

    eTechDude.com Member

    Messages:
    205
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #2
    1: in the iframe source code. include <a href="iframe2">all your iframe code hereeee</a> i think this could work.
     
    eTechDude.com, Apr 24, 2008 IP
  3. feivi18

    feivi18 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi eTechDude,

    First of all, I'm assuming you meant href="iframe", not "iframe2", right? In any case, I tried it both ways with another few variations (included target=), but unfortunately nothing worked :-(.

    Please do let me know if you think of anything else!

    TIA

    Feivi
     
    feivi18, Apr 24, 2008 IP
  4. ToddMicheau

    ToddMicheau Active Member

    Messages:
    183
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #4
    So your not talking about something as simple as http://bubblecoder.com/test/ that are you? Do you mean all links as in links from other sites?
     
    ToddMicheau, Apr 24, 2008 IP
  5. feivi18

    feivi18 Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Right. Let's say the iframe on the right had cnn in it, I would want any link clicked to open in the iframe on the left. Can this be done?

    TIA!
     
    feivi18, Apr 25, 2008 IP
  6. ToddMicheau

    ToddMicheau Active Member

    Messages:
    183
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #6
    That can be done with a simple php script- use cURL to get the page, spit the source at the <a tag (use regex), then insert "target=\"framename\"" at the end of each array slot. The frame name would depend on a flag in the script. . . Actually not that simple I geuss. . . This script will then concat the array, and print the resulting source code, in an iFrame.
     
    ToddMicheau, Apr 25, 2008 IP