Break Out of a Frame on Page Load
November 22, 2005 by Kristy
Filed under HTML, Site Building
Does someone link to your site from inside a frame and now your site ends up inside of their page’s frame? Do you get a lot of referrals from search engine image searches and get stuck in their frame too? Me too, I have a little of both actually and I wanted a way for my site’s pages to load in their own frame automatically or “break out of the frame” while the page initially loads for the visitor without them doing anything themselves. Thankfully, I found that this is quite simple to do all you need to do is add the below code to your BODY tag.
Code to add
onLoad="if (self != top) top.location = self.location"
Place code in your body tag. Like this:
body onLoad="if (self != top) top.location = self.location"



