Forum Moderators: open

Message Too Old, No Replies

Force page open in iframe on parent window call

Force page to open in iframe on parent window call

         

lasdesign

1:29 pm on Aug 1, 2005 (gmt 0)

10+ Year Member



Hi,
I have a page "B" that i have loaded into an iframe (done through the src tag of the iframe) on page "A".
The links on page "B" all have a target window set to Parent.

What i need, is to be able to click on these links on page "B" and for the iframe to capture the requested page instead of a new page opening up and losing the iframe.

If you can help with some form of javascript, or if i havent explained clearly enough for you to comment on this thread, please reply either way.
Regards,

LAS

kaled

6:33 pm on Aug 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I understand you correctly, you want (some) links located in the IFRAME to open in the IFRAME.

If that is the case, I think setting target="_self" will work for you.

You should also look at the <BASE> tag if you are unfamiliar with it.

Kaled.

lasdesign

8:31 am on Aug 2, 2005 (gmt 0)

10+ Year Member



Hi Thanks for your reply.
Let me explain fully what i mean.

Page "B" (is a page that i am not able to edit)this page i have loaded into an iframe on page "A".

The links on page "B" all have a target window set to Parent. The only page that i have access to edit is page A with the iframe.

And to make matters a bit more difficult, page B is a page made up of three frames.

What i need, is to be able to click on these links on page "B" and for the iframe to capture the requested page instead of a new page opening up (because of the parent target) and losing the iframe.

Cheers.

kaled

10:01 am on Aug 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What you need is something like

window.document.base.target="self";

Unfortunately, I don't think document.base exists but it's worth experimenting.

Kaled.

lasdesign

1:30 pm on Aug 10, 2005 (gmt 0)

10+ Year Member



Ok since the last time i replied to this thread ive moved a little further on my journey in solving this problem.

What ive managed to do:
1 - Read in the details of the iframe document contained within my page (Window).
2 - Having read the iframe document, i then set the target elements on the document to "self" instead of "parent". This then allows all links, when clicked, to open in the same iframe window.

The problem i have now is;
When i click on a home link within the iframe document that points me back to the initial iframe source document the code i have implimented to change the target elememnt, no longer works. Is is possible to some how get javascript to run the code each time the iframe document changes within the window?

Im assuming it would be some kind of "on document source change" event, i just need an initial pointer to the event launching code.

If anyone can help id appreciate it. If you need to see any code ive done so far i can upload it on here.
Thanks.