Solved

Brower Back button question

Posted on 2006-11-04
6
263 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

830 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