Solved

Brower Back button question

Posted on 2006-11-04
6
262 Views
Last Modified: 2010-04-06
Hi, experts,

Is there a way that a PAGE can tell which PAGE the user navigated from by licking the back button from the brower.

I tested both request.servervariables("HTTP_REFERER") in ASP and request.getheader("REFER") in jsp, both does not working in case of Back button navigation instead of a real request --- it's understandable.

A link to certain page is clicked out side of a J2EE application and the application is handling the request by a typital servelet gateway and then redirected it to certain dedicate page (A.jsp) from there a FORM submit is made to final page(B.jsp)

I think it's a typical design, but since the redirect is made through the framework (submit ,etc), pressong back button from b.jsp can only goes back to the redirecting page A.jsp and then loop back to B.

obviously location.replace does not working as I tested, I am thinking to use location.go(-2) on the A.jsp but  I need to know where the request is coming from to make the decision...

Any input is highly appreciated!

0
Comment
Question by:ca_roland
6 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 100 total points
ID: 17875477
No,

for a back button there is no header being sent to the server - if there is a refresh the browser treats it as sending the same header it sent when originally loading the page.

You potentially could write a cookie when loading a page of yours so then if there is a back button being pressed and there is the same session but a different page you could register it - but apart from that I do not know of a solution.
0
 

Author Comment

by:ca_roland
ID: 17876136
Raynard7,

Can you explain this more :

  if there is a back button being pressed and there is the same session but a different page you could register it

0
 

Author Comment

by:ca_roland
ID: 17876141
Raynard7,
 
 
How about if  the user disable the cockie, then I guess, it will invovled in a framework for statement--- correct me if I am wrong
0
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

Author Comment

by:ca_roland
ID: 17876180
Imean : " invovled in a framework for statement management"
0
 
LVL 26

Assisted Solution

by:DireOrbAnt
DireOrbAnt earned 150 total points
ID: 17877094
It would be a breach on privacy/security and the browser sandbox to allow you to retrieve the browser history.
Like Raynard7 proposed you can implement it yourself using some kind of session, but yes, if you use cookies, they can disable them.
I don't know about jsp, but .net 2.0 allow cookie-less sessions by transforming the URL (adding a subfodler with the sessionid in it).
You could also throw a sessionid as a form element, but that tends to be a lot of management.
0
 
LVL 4

Assisted Solution

by:yeroket
yeroket earned 150 total points
ID: 17879099
if page A and B are on the same server, then the servlet can dispatch page B as the result without dispatching a middle/forwarding page. by doing:
import javax.servlet.RequestDispatcher;

RequestDispatcher dispatcher = request.getRequestDispatcher("B.jsp");

dispatcher.forward(request, response);
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question