Reliable Answers - News and Commentary

'Break Out' Frame Break-out Script

Breaks out of frames on a page. Very useful for when your site(s) have had their content framed by other sites and you want to have your site given it's proper attention.

<script language="javascript" type="text/javascript">
/* ====================================================== *
': This forces the current document to the top of any 
': frames. 
': You MUST either remove it or comment it out if you  
': want the page to be frameable in browsers supporting
': scripting.
'* ====================================================== */
  if (top.location != self.location) {
    top.location.replace(self.location);           // pop to top
  }
</script>

Basically, all this does is find out if the parent frame has the same URL as the current frame, and sets the parent frame's url to this frame if not.

This code will also prevent you from framing your own pages, so, uh, it's not always what you may want to do on your page(s). There is a better solution however, check out the Super-Break-Out and/or the Pseudo-Break-Out scripts.

Caveats:

As always, client-side script requires that the client support script in order for it to work at all. Though it is rare these days that a browser will not support script, it may be disabled or limited due to security concerns. As long as scripting is available on the client this script should function correctly without errors.

As stated before, this script will also prevent you from framing your own site! If you need to frame your own site there are other options, like Super-Break-Out and Pseudo-Break-Out.

Carschooling by Diane Flynn Keith
Carschooling

Take me to the top

We invite you
to visit:

Professional Web Hosting and Design Services: 12 Point Design Local Homeschool provides the most up-to-date support group listings in a geographical and searchable index Budget Homeschool Kidjacked -- To seize control of a child, by use of force SaferPC dispels security misunderstandings and provides you with a solid understanding of viruses and computer security Reliable Answers - developer information, current news, human interest and legislative news Twain Harte Times - Twain Harte, CA - The closest you can get to Heaven on Earth Cranial Laser & Neurolymphatic Release Techniques (CLNRT) - Experience dramatic pain reduction At Summit Chiropractic our mission is to improve your quality of life - We know that health is much more than just not feeling pain Visit UniveralPreschool.com to learn about your preschool options.
Reliable Answers.com/js/break_out.asp
Google