This checks to see if a page is loaded in iFrame, if not it redirects to another url. It is very ugly, it shows the page just before it redirects. I am wishing for another more smooth redirect.
<script>
function check_frame() {
if( top === self ) { // not in a frame
location.href = "/link/to/some/url"; // either the frameset or an error.
}
}
</script>
<body onLoad="check_frame()">
... normal code for your page here ...
</body>