[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Brower Back button question

Posted on 2006-11-04
6
Medium Priority
?
269 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 300 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

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

Assisted Solution

by:DireOrbAnt
DireOrbAnt earned 450 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 450 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to dynamically set the form action using jQuery.
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…
Suggested Courses

834 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