...

access to pages

nerdgrrl
06-17-2002, 08:22 PM
I am looking for a script that will only let a user access a certain page if they came FROM a designated other page. Is that possible?

Thanks!

bpaulsen2000
06-17-2002, 08:40 PM
hi,

don't have a sample for your right now, but what you're looking
for is the window.referrer function.

nerdgrrl
06-17-2002, 11:58 PM
Thanks! Does anyone else out there possibly have a coding example for me?

whammy
06-18-2002, 12:30 AM
Keep in mind that It's not totally reliable - for instance it won't work if they access your page directly (from a bookmark, for example), since there will not be a referrer in that case. However, you did ask for an example!:

<script language="JavaScript" type="text/javascript">
<!--
var thereferrer = document.referrer;
if(thereferrer != "http://www.mysite.com/myreferringpage.html"){
window.location = "http://www.barbie.com";
}
// -->
</script>

If you're not sure what the document.referrer IS, you can type this in the address bar (it should even work right here, right now...)!

javascript:alert(document.referrer)

:)

nerdgrrl
06-18-2002, 03:22 AM
Thanks so much! I will give it a try tomorrow!:D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum