| Bustin' Out With Frame Busting by Geoff Blake (posted May 17, 2006) |
|
When working with framesets, it’s a major no-no to link to other web sites and have them appear within your frameset. Some sites do this as a way to try to keep the visitor from leaving their site entirely. With a site appearing within another website, it makes the external site look like it’s a part of the framed site. Sneaky. Don’t forget, the point of frames is to provide navigation for web users, not to control them. Now, what do you do if you find your own site stuck in someone else’s frames? The best approach is to use JavaScript to detect if your page appears within a frameset. If it does, the code will reload your page into the browser window, replacing the frameset. A wee bit of hand coding is involved to get this to work. If you’re squeamish, don’t worry—it’s actually really easy. Here’s how to hand code JavaScript to bust out of frames:
If you want to make sure that all the pages in your site will bust out of frames, you'll have to add this code to each page. There goes your weekend.
Wanna test it out? Try building a quick frameset, then link to your page from your own frameset. Like magic, it’ll bust out. Nifty, huh? So now you know how to break out of other site's frames! [ Back to Web + Mag Articles ]
|