• home
  • forum
  • my
  • kt
  • download
  • Breaking out of frames

    Author: 2007-08-08 09:47:10 From:

    Place the following code in the header

    <script language="JavaScript" type="text/javascript">
    <!--
    function break_out_frames()
    {
      if (top.location != location) {
        top.location.href = document.location.href ;
      }
    }
    -->
    </script>

    I would prefer to place the javascript function into a separate file with a name like "functions.js". This is how the code would look inside the "functions.js" file:

    function break_out_frames()
    {
      if (top.location != location) {
        top.location.href = document.location.href ;
      }
    }

    To include the javascript function file into your pages, place the following code in the headers:

    <script src="functions.js" language="JavaScript" type="text/javascript">
    </script>


    To trigger the breakout of frame javascript function, using ether of the above techniques, add the following code to the body tag:

    <body onload="break_out_frames()">

    That's it.

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      AJAX (20)
      Content Management (7)
      Cookies (4)
      Date and Time (12)
      Development (7)
      DHTML (14)
      Forms (8)
      Frequently Asked Questions (1)
      Image Display (9)
      Introduction to Javascript (5)
      Links and Buttons (4)
      Menus (2)
      Miscellaneous (5)
      Mouse Tricks (3)
      Navigation (8)
      Randomizing (4)
      Security (1)
      Text Effects (6)
      User Authentication (2)
      User Information (5)
      Windows and Frames (3)

    New

    Hot