faqts : Computers : Programming : Languages : JavaScript : Browser Settings

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

56 of 75 people (75%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

How can I prevent a user from bookmarking a page?
How can I force a user to login before viewing a page?

Aug 27th, 2000 04:28
Martin Honnen, Chris Durkin, Mike Hall, pat per,


You can't prevent a user from bookmarking a page. You could try to make 
it harder by using javascript to open the URL in a window with no 
toolbar and disabling the right-click pop-up menu but a clever user can 
always beat that, if nothing else than by manually adding the URL to 
his 
or her bookmarks.
If you want to force a user to go to a particular page, like a login 
screen or your homepage, before accessing other pages, you can use a 
server-side solution, such as ASP.
Or, you could have each page in your site check for a session cookie 
that is set by your home page using Javascript. Session cookies expire 
with the browser session, and can be set by leaving out the Date 
parameter when you set the cookie. If the cookie is not there, redirect 
to the home page.
Of course, this client-side solution will work only if the user has 
both 
cookies and Javascript enabled.
It should be added that the best solution to password protect your web 
pages is to use server side authentication. Any decent web server 
supports that and allows to configure it without much hassle.