search engine optimization articles do it yourself seo hiring search engine experts html and search engine optimization web site analysis and submission service

HTML Help: Break Frames

How do I prevent my site from being displayed in someone else's frames?
A little JavaScript will keep your site from being trapped in someone else's frames in most cases. It won't work in browser's that have JavaScript turned off, but most people do not have JavaScript disabled.

Place the following code in the HEAD section of your page:

<script type="text/javascript">
if (top.frames.length!=0) {
    if (window.location.href.replace)
        top.location.replace(self.location.href);
    else
        top.location.href=self.document.href;
}
</script>

This has to be done on a page-by-page basis. If there are just a few problem pages you won't have much work, but if it's a problem across your site you may have a lot of work inserting that code in every page.

If that's the case I recommend using a search and replace utility to make batch changes, then the only work you'll have to do is upload the pages.

This concludes the

HTML Help about Breaking Out of Frames

.
Back | HTML FAQ | HTML Tag Chart | HTML Index | Web Design Tutorials
search engine optimization course
If you want your web site to rank high in the search engines . . . what are you going to do to get it there? Check out my search engine optmization guide, SEO for YOU: Search Engine Optimization for Ordinary Everyday People!

Check out SEO for YOU now!

Almost a Newsletter

Subscribe today for exclusive website design tutorials and grab some free gifts to boot! Learn more, or subcribe below:
Email:

First Name:

Privacy Policy

Did you know...

The member's site has about 100 standards compliant HTML and CSS tutorials, 31 handy reference charts, reprintable content, web graphics, exclusive fonts, free software, free ebooks and more? All this for less than 9 cents a day! [ Details ]
See my fancy bottom! :)