Click to See Complete Forum and Search --> : open filename.htm only from index.htm


alvarohig
03-02-2003, 06:42 AM
Is there a script I can use that ensures that access to the page 'filename.htm' is granted only from page 'index.html'?

'index.html' has a password to access 'filename.html'. I want to avoid indirect access to 'filename.html'

Thanks

A. Higueras

Charles
03-02-2003, 07:44 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>index.html</title>
<p><a href="filename.html" onclick="window.open(this.href); return false">filename.html</a>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>filename.html</title>
<script type="text/javascript">
<!--
if (!(opener && /\/index\.html$/.test(opener.location.pathname))) self.location = 'index.html';
// -->
</script>

Dan Drillich
03-02-2003, 07:54 AM
Please try -


<script>

if (document.referrer != "index.html")
window.location = "http://home.mysite.com";


</script>