Stoping a page from being a "Favorites"

J

JCO

How do you make a page that can not be save in someone's favorites. I have
a page that if they bookmark it or save the page, when they come back to
that link, I would rather it go to the home page.

Is this possible?
 
C

chris leeds

I don't think you can prevent it from being added but you can use a server
side scripting (asp asp.net php) to test for referrer (the last page or site
they were on) and if it's not the one you want them coming in from redirect
them back to the home page.
HTH
 
J

Jon Spivey

If they've clicked a link from favourites referer would be empty so we could
check for that - either server side as you said or client side
<script type="text/javascript">
if(!document.referer)location.replace('default.htm')
</script>

Jon
Microsoft MVP - FP
 
J

JCO

Awesome!
This script was just what I needed.
Thanks a bunch, it works great (with a few modifications).
 
C

chris leeds

if the page is something that you want to hit from only one page then it
might be easier to just test to see if the referrer is indeed that page and
if not send them to whatever page you want them on.
IMHO if it's really important you would want to use some server side script
to make sure that the browser or pop-up blocker doesn't disobey. ;-)
HTH
 
J

JCO

Okay, sorry so long to get back to you.
I thought this script was working but it is not... as I intended.
It does stop someone from grabbing it from their favorites and I can
redirect them to the home page, however, If I have a direct link to the
page.. I want them to make it to the page. This script stops anyone from
ever making it to the page.

I'm assuming that theirs more to it that I simply don't know. Maybe you can
explain further. I have a password protected page. I want to get to the
page if the password is correct. Now I want them to not be able to save the
page. I still want the page to be available via the correct method.

How do I make corrections. Does this make sense.
 
C

chris leeds

how many pages do you have a link to this one page on? I think it'd be
easier to do it this way:
if the referrer is one of those pages you've got the link on then nothing
else redirect them back to the home page.
what is it you're trying to do anyway?
 
J

JCO

I have no links to this page. I have a link to a logon page that runs a
script. The script takes you to the page. My concern is to stop someone
from making the page a favorite...hence avoiding the logon page (and yes I
realize if the user has it in his favorite, then he must be a member and is
authorized... I prefer him to logon each time).

With the referrer script in place, a person that loads it from a favorite
get redirected to the homepage where he has to go through the proper logon.
The problem is that theirs no way to get to the page at all. Even after the
logon prompt validates the password, the user is redirected to the index in
an endless loop.

I hope this makes sense.
 
T

Thomas A. Rowe

JCO,

The problem is not with users bookmarking or add the page to their
favorites, the problem is with your validation code that suppose to check if
the user is entitled to access the page.

No matter how the user reaches the page, if they are not logged in at the
time, they need to be re-directed to the login page.

Example:

Login validation page, if the login is successful then set the following
values:

<%
Session("Authenticated") = 1
Response.Redirect ("member.asp")
%>

On the member.asp page, check to see if the Session("Authenticated") is not
0:

<%
If Session("Authenticated") = 0 Then
Response.Redirect ("login.asp")
End IF
%>

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================
 
C

chris leeds

answer is simple then. I've got a script for you (or you could find your
own) that password protects the page "for real", that way you can forget
about all this stuff you're trying to do. it's simple as anything and will
work perfectly if you only need one password.
If you want the one I've got you must be able to run an asp page.
 
J

JCO

How do I know if I can run an asp page?
I'm using a free host at the moment. One that puts advertising on my web.
It's all I can do for the moment. I know, on the server side, they won't do
much for me. That is why I was trying to do it with a J-Script. I don't
know anything about ASP but will certainly give anything a try.
 
C

chris leeds

I'd ask the admins what you can run. usually a free server is a UNIX
machine (usually) so you probably can't run .asp. you could run php so you
might want to go to www.hotscripts.com and look for password protection
scripts in php. there is a ton of free php stuff out there and I'm sure
you'll find a simple one for the page. by simple I mean that you'll have
just one pass/ user and it'll work on your page by a simple include.
HTH
definitely this is the way to go. it's needlessly complicated to try to
test for the referrer. I wish I knew better when you first posted and could
have saved you a lot of time.
 
Top