Forum Moderators: open

Message Too Old, No Replies

Breaking out of frames

Need to frame a site but don't want to trap users

         

Philosopher

11:51 pm on Jul 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok...let me preface this by saying I HATE frames, can't stand them, and as a result, haven't used them.

Unforunately, for a new project I think it will be necessary to frame a page or two here and there from sites I don't control, but I don't want visitors to get stuck in the frames.

Is there anyway to frame a site, but have the user break out of the frameset upon clicking a link that resides on the target site? I know you can add the target="_top" to a link to break out (or as a BASE in the head), but as I said, I won't have control of the target pages so I need something I can do on my end of things...if their is such a thing.

If memory serves me, security settings in the browsers won't let me "affect the operation of an outside page" so I'm betting no, but I thought I would see if anyone has any ideas.

keyplyr

1:28 am on Jul 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You can do it with a little JS:

if (parent.frames.length > 0) {
parent.location.href = location.href;
}

Philosopher

2:11 am on Jul 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmm...maybe I'm being a bit dense today, but that doesn't seem to be working.

I added the code suggested to the <head> section of the frameset page, but it still doesn't break out of the frames when a link on the target site is clicked on.

tedster

2:57 am on Jul 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



keyplr's script is intended for the framed page - but you don't have access to that page's code, if I understood you correctly.

I think you need a button/link on the other page in your frameset - the one that you DO control - so that people can click on it and have the second frame's page load on its own, outside your frameset.

Would that work? It won't work automatically on any lick click (you guessed right, you can't access that function from your server) but it does let your visitors choose when and if to exit your frameset. About.com did it this way for years.

keyplyr

4:00 am on Jul 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Oh, sorry - I misunderstood.

Philosopher

4:09 am on Jul 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I was afraid of that. It's not the best option, but if it's the only one it will have to work.

Thanks for the assist.