Forum Moderators: phranque
Even if you were able to reliably detect the referer, try this scenario: I search for, say, a product in Google, and a page from your site came up as a result. However, rather than displaying the page with the information I want, you drag me away to your front door and make me try and find the information again. Faced with this, again I would go elsewhere, and you would lose a potential customer.
You can technically do what you were looking for, but it is a very, very bad idea in terms of usability. Do this, and you are putting a massive barrier between the user and the information they want! Remember, every page is a front page, so make sure you have good content as well as a menu and a simple link back to your index page.
A relatively common solution:
<script type="text/JavaScript" language="JavaScript1.1">
// Escape from any referring site's frame, but enable one-click "Back".
if (parent.frames.length > 0) top.location.replace(document.location);
</script>
<noscript>
<center>
<p><font face="Arial,Helvetica">If you've come here from another site, <a href="mainframe.html">click here</a> to restore the site navigation frame.</font></p>
</center>
</noscript>