Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Document.referrer questions

Status
Not open for further replies.

puterdude

Technical User
Apr 13, 2001
51
US
I'm trying to do "a little" site protection. I have this code on a page which I only want accessed from a page on my site. I want the javascript to check that it came from there. If it did load the page, if it didn't, go to an alternate page.

I am coming from the correct page and it shows that.

document.write("you came from " + document.referrer)

if document.referrer.value != " { location.replace("disc_welc.htm");
}

It works but send itself into an endless loop, because, of course, I'm telling it to. D'oh!

I want LINK to disc_welc.htm and if it checked out that it came from the right place, display the disc_welc.htm page. If it didn't, go to alternate page.

Does this make sense? Can I do this? I realize the code I have says if not from, then go there, but I don't want to endless loop, but I do want to tell it to go to that page.

Arg... I think I'm in an endless loop.

Thank you.

Puterdude
 
I'm trying to protect the disc_welc.htm page as well as others. Basically, I created a discussion group with Frontpage. My ISP doesnt allow for protected webs so I can't have registered users only in the discussion group, which is kind of a must. They do offer a protected directory, but of course, frontpage wont work if I put it in there. Therefore, I have put a page in the protected directory with a link to the other page disc_welc.htm.
Disc_welc.htm makes sure it came from the protected page, if not bounce it to a place to register. Other pages in the site have to check to make sure they came from only the other pages in the site. It's going to be ugly.

thanks for helping.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top