;

PDA

Click to See Complete Forum and Search --> : Closing frames using Javascript


richthemarine
02-15-2002, 07:05 AM
Help anyone,

What i am trying to do is control the frames in the browser windows. The Problem is with MS keywords, when you access a site via this method your site is displayed but in a bottom frame. The top frame contains a banner from MicroSoft advertising the keyword service. What I want to do is allow the bottom frame with the site to be displayed but to disregard the top frame. Now can you do this by changing the parameters of the top frame or do you have to redirect to a completely different page?

I know I havn't explained myself very well but I think my question is this: Can you control a top frame from Javascript inserted in the bottom frame and if so how?

PPPPPlease help, quite urgent

Richthe ex marine

jamiec
02-15-2002, 12:09 PM
Sure you can - frames are just part of the document object model (DOM).

from the bottom frame:


top.top_frame_name.location.href='some_other_page. html'


that will change the URL of the top frame.

However, if the top frame is http://somedomain.com and the bottom frame is http://someotherdomain.com you cannot communicate between frames as I just demonstrated.

edeveloper
02-15-2002, 02:36 PM
you can put this in the head of your page:
<script language="JavaScript">
<!-- //hide from old browsers
if (self != top) top.location.href = window.location.href;
//-->
</script>