I have a web page which should not be accessed directly. That is it has to be accessed thru a parent page. How can this be done? For eg this can happen when you are trying to do a google search... It can some times directly lead you to the child page. How to solve this?
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
posted
0
You can check the document.referer If the referer is not the main page then send them back to the parent page.
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
document.referrer works fine but i have a situation... I have a page(p1.htm) which has two buttons "agree" "do not agree" when I press agree the current window closes and opens another new window(p2.htm). So when I use document.referrer in p2.htm page it shows null. How to take care of this? I do not want the user to directly open p2.htm without going thru p1.htm. Thanks and appreciate ur help.
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15003
posted
0
when you open a new window it will cause this to happen since it will have no referer. You might want to look into using query strings.. Eric