Reset a framed page when called directly from a search engine

Framed sites are sometimes a necessary evil. But things can go wonky when a search engine links directly to a child page. The following tip will help you direct visitors to the parent frameset if they do not walk in the front door to your site.

The following javascript can be used in a child page to redirect to the full frameset.

<html>
<head>
<script type="text/javascript">
	function check_for_frames() {
		if (top.frames.length == 0) {
			top.location="http://www.yourdomain.com/parentframeset.html";
		}
	}
</script>
</head>	
<body onload="check_for_frames();">

<p>This page is being forced to be viewed in a frameset.</p>

</body>
</html>
Undefined
Topic: