<p>I have a page which work like a navigation and a iframe in this page which show the content. </p>

<p>Now there are some situation when the inner page is directly shown in the browser. 
eg: if somebody types the inner page's url in the browser address bar, the page is displayed in the window. </p>

<p>I want to prevent this. </p>

<p>Better still, I would like to redirect to any other page.</p>

```
```
<script language="Javascript"><!-- 
if (top.location == self.location) { 
  top.location = "index.html" // must be viewed in main index
}
//--></script>
```
```
modified it from a situation where an an iframe decides to become the main frame.