aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes accessing page thru main page only. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "accessing page thru main page only." Watch "accessing page thru main page only." New topic
Author

accessing page thru main page only.

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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
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
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
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
 
IntelliJ Java IDE
 
subject: accessing page thru main page only.
 
Threads others viewed
Quote for Programming Job
Marcus Green exam question
local variables
VLH of petstore
Public folder in JavaEE website
developer file tools