Solved

Brower Back button question

Posted on 2006-11-04
6
259 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
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…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now