Click to See Complete Forum and Search --> : Script to not allow Bookmarks


stimpy
03-21-2003, 07:00 PM
I have a page that can only be viewed by those who successfully log in. I would like them to have to log in each time and not bookmark the page they are wanting to view. I know it is possible to disallow right-clicking. Is it possible to disallow bookmarks?

I would appreciate any help anyone can offer.

khalidali63
03-21-2003, 07:42 PM
No.Javascript does not give you control over browser itself.

Cheers

Khalid

rkmarcks
03-23-2003, 11:13 PM
As stated, you cannot prevent someone from bookmarking your page. However, there are some things you can do to accomplish what you want.

Put your original window inside a frameset. Setup the frameset so it only has one frame with the default page being the one you want your users to see. Of course, this does not prevent someone from right clicking, selecting properties and getting the url of the page within the frame, then entering a manual bookmark. Place one of the following in your page:

<SCRIPT LANGUAGE="JavaScript">
if (self != top)
{
parent.top.document.location.href="index.htm";
}
</SCRIPT>

-or-

<script language="JavaScript">
if (self.location == top.location)
{ top.location = "index.html" }
</script>

If that page was bookmarked, either of these scripts should reload the index page from where you want your users to start. Both scripts are small enough they could probably registered to an onload event inside a body tag. At a minimum, you could make a function call from an onload event within the body tag.

RKM

Nedals
03-24-2003, 12:21 AM
How do your users currently login? Do you use a server-side script? Depending on your answer, there may be several alternatives.