Powered by InterCreatives | Site Map
Search:
NewSourceMedia Popular Tutorials: PHP Javascripts Web Hosting
SoftwareTutorials
CATEGORIES
Job Listings
 
Home / Javascripts / Window Effects

Breaking out of frames

Published by: Alexander Mclean III


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.

For a list of Books on Javascript for Beginners and Advance Coders click here!


Next Javascripts Page:
[1]  2  3  4  5  6  7  8  9  10  11  12 





Hosting by iPowerWeb.com - 50 Gb for $7.95