A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Closing frames using Javascript

  1. #1
    Member
    Join Date
    Mar 2001
    Location
    South West of England
    Posts
    96
    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

  2. #2
    .NET addict
    Join Date
    Sep 2000
    Location
    St Albans, UK
    Posts
    12
    Sure you can - frames are just part of the document object model (DOM).

    from the bottom frame:

    Code:
    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.

  3. #3
    Senior Member
    Join Date
    Aug 2000
    Posts
    1,317
    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>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center