Hints And Tips research knowledge archive
Tip# 368
Sponsored Links
 
Subject: Javascript Frame breaker!
Updated: May-21-2005
Rating: Not Rated
By: Rocky Moore - Member #: 461
Location: Klamath Falls, Oregon USA
Website: www.ReflectedThought.com
Category: Computers > Programming > General Web Development
Rate This Tip (10=Great):  1  2  3  4  5  6  7  8  9  10
At times, people may visit your site via someone else's site who is "framing" your site.  That is they are putting your content into a frame of their window which can appear to be part of your site but is not.  Other times, you may have a need to make sure your page is viewed as the only frame in the browser.  In either case, a simple javascript solution is to add:

<script language="javascript" type="text/javascript">

if (top.location != self.location)
{
    top.location = self.location;  
}

</script>

Or:

<script language="javascript" type="text/javascript">

if (top.frames.length!=0)
{
    top.location=self.document.location;
}

</script>

[Submit DIGG for this tip]


-----------
Note: Use the tips posted on this site at your own risk. The tips are posted by the public and as such may or may not be valid.

Sponsored Links
     
Categories
hints and tips gold divider
Sponsor Sites To Visit
www.SaintsInLight.com
Thoughts on the Christian walk
along various Christian links.

CICK HERE
www.BringingInTheHarvest.com
Christian:  The harvest is ripe and
the day is short, we need to bring in
the harvest while there is time!

CLICK HERE
XML RSS News Feed For Recently Posted Hints And Tips  RSS Feed
You can now get updates to the Recent Tips section by using RSS. The address is:

HintsAndTips.com/Rss.aspx

* Posting Tips *
To post a Tip, Recommendation or Tips Wanted, simply browse to the category you feel is a best fit for your post (click on the Recommention or Tips Wanted tab if fitting) and then click on "New Post" option.
(C) Copyright 1998-2010 All Rights Reserved