Click to See Complete Forum and Search --> : Retarget links in Iframe


Travman
10-09-2003, 03:07 PM
Does anyone know how to write a script using src.Element to retarget hyperlinks, originating within an Iframe, to load in the iframe (regardless of how the hyperlink is coded)?

The constraint is - the code that appears in the iframe cannot be revised.

Dimitri
10-09-2003, 06:19 PM
Maybe I'm not understanding what you want to do exactly:

You want to use srcElement to retarget links inside an iframe? That's not necessary.

If the links are clicked from within the iFrame they will automatically open inside the iframe.

Unless you want the links in the iframe to open in the main browser window, at which point you can add target="_top" to the anchor tags of those page contained in the iframe.

Dimitri

Travman
10-09-2003, 06:31 PM
Sorry to be confusing. I have an Iframe, that I'm pulling content into, from my Intranet at work. I can't change the HTML of the pages that I'm displaying in the IFRAME.

Currently, when the reader clicks a link with a target of _top or _blank (I think) it causes the browser to load the page into the full window. I want to change this behavior to load all links either within the iframe, or as a whole new browser window (leaving my navigation page intact).

In terms of preventing JS like this: onclick="parent.location='URL';"
I have hacked my page with the following in the Head:

function Location() {
}
which seems to work, but has no effect on the hardwired HTML targets.

Dimitri
10-09-2003, 06:59 PM
Unfortunately, the target="_top" (or _blank) don't work the same way, as it's not going about it via Javascript.

If these targets exist in the anchor tags, there isn't anything you can do about it (to my knowledge).

Even naming the iframe window name as "_top" won't work either.

Sorry dude.

Dimitri

Travman
10-10-2003, 09:41 AM
Thanks for the response, though.

I find that if you're new on a forum, or you don't phrase your question just right, you tend not to get very many responses. Thanks again for your insights.
-TravMan