Click to See Complete Forum and Search --> : Please help a Javascript novice! Important, for a client!
wdu2003
10-17-2003, 10:51 AM
I am not experienced at writing Javascripts, only using them and I can occassionally edit one if its minor, but I have a need for a Javascript that I have not been able to find and hoping some kind person can help me out with locating one or writing one. It shouldn't be anything too long. But what I need is a javascript that PREVENTS someone from bookmarking a page. I need it to give them an error, popup, redirect, whatever when someone tries to save or bookmark the page. I'm trying to prevent someone from using the "backdoor" so to speak to gain access to a page instead of going through the referring links. I can and will encrypt the page itself so they can't just write the URL down, but I need it to not allow them to bookmark it either. Can anyone help? This is for a client site and I'm not sure what to tell them since I cant find a script. Thanks!
chestertb
10-17-2003, 11:14 AM
Hi,
One solution would be to write a little routine that looks for a cookie that is only created on the front door page. If the browser didn't find the cookie, you'd automatically flick them out of the page they've bookmarked and back to the front door.
It would look something like this...
In the page header...
<script language-"Javascript">
//check if cookie from the frontdoor exists
if(document.cookie == '') //which means there's no cookie
{
top.location = 'frontdoor.htm';
//which flicks them out of the page and back to the front door.
}
</script>
That will only work if either the site hasn't created cookies for anything else or the user has closed his/her browser between visiting the site and gaining access the first time, and using the bookmark to access subsequently. If either of these creates a problem, you could control access in a similar way, but via the data within the cookie, rather than just checking if the cookie exists.
Might not be the perfect solution but I hope that helps,
IB.