Solved

How to trap Back/Fwd buttons of browser?

Posted on 2001-07-22
9
184 Views
Last Modified: 2011-09-20
when i load an ASP page, is it possible to find whether we have come to that page after clicking Back/Forward button? i.e. can i trap these events and take actions based on the event.
I want do take certain actions depending on the
button clicked - if back/forward button is clicked then instead of sending the request to server, i
want to load the page from client and do some checking.
0
Comment
Question by:gaurav
9 Comments
 
LVL 30

Expert Comment

by:third
ID: 6307458
it's more convenient to use sessions rather than tracking down these events which as far as i know not possible. e.g. on a login page, create a session say "UserName" (that will be filled with this asp page). in your code check if that session has a valid value else simply display an error.

If Session("UserName") = "" Then
  Response.Write ("<DIV ALIGN=CENTER>You are not logged in!</DIV>")    
  Response.End
End If

...
your asp scripts here....
...

Session("UserName") = ""
0
 

Author Comment

by:gaurav
ID: 6307547
The purpose is from checking the user authentication. I want do take certain actions depending on the button clicked - if back/forward button is clicked then instead of sending the request to server, i want to load the page from client and do some checking.
0
 
LVL 19

Expert Comment

by:webwoman
ID: 6308353
Is this limited to forward/back from only certain pages? If so, you could use document.referrer, which would give you the URL they came from.

You're not going to load the page from the CLIENT -- you can't force that. If you want to store some values on the client, use cookies and check for them.

This is pretty common for a passworded site. They log in, a cookie gets stored, you check for those cookie values on each subsequent page. Usually you put name/date and maybe pw in the cookie, and check them.
0
 

Author Comment

by:gaurav
ID: 6308395
no - its not for certain documents but for all the pages - also, since lots of data in form of XML DOM is sent to the client, its not possible to use cookies also. If the back / forwar button is clicked, i want to check if that xml dom exists in client, if yes then reload the page from the client side only else send the request to server.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 6

Expert Comment

by:Nitin Sontakke
ID: 6308676
Dear Gaurav,

A real comment only. No solution to your answer.

With my current knowledge of http, i think you are expecting a bit too much. HTTP is stateless and both client and server just forget everything about each other after a single set of data transfer (request/response).

And essentially for this reason all the business about, session state, cookies, etc.

I hope you get my point. Any doubts/questions?

0
 
LVL 6

Expert Comment

by:Nitin Sontakke
ID: 6308685
I wanted to say "No solution to your question."
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6791781
It's time to clean up this topic area and that means taking care of this question. Your options at this point are:

1. Award points to the Expert who provided an answer, or who helped you most. Do this by clicking on the "Accept Comment as Answer" button that lies above and to the right of the appropriate expert's name.

2. PAQ the question because the information might be useful to others, but was not useful to you. To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

3.  Ask Community Support to help split points between participating experts.  Just comment here with details.

4.  Delete the question because it is of no value to you or to anyone else.  To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

If you elect for option 2, 3 or 4, just post comment with details here and I'll take it from there.  We also request that you review any other open questions you might have and update/close them.  Display all your question history from your Member Profile to view details.

PLEASE DO NOT AWARD THE POINTS TO ME.
____________________________________________

----------------------->>>>>>>>>>>>>>    Hi Experts:

In the event that the Asker does not respond, I would very much appreciate your opinions as to which Expert ought to receive points (if any) as a result of this question.  Likewise, you can also suggest that I PAQ or delete the question.  Please let me know if no response the next 3 days.

NEW topic areas added Feb 8, 2002.  http://www.experts-exchange.com/jsp/zonesAll.jsp

Thank you everyone.

Moondancer :)
Community Support Moderator @ Experts Exchange
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7152109
________________________________________
do not accept this comment as the answer

this question has been abandoned. experts please
post recommendations below to help the moderators.



________________________________________
my recommendation
0 point paq
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 7181519
Per recommendation, points refunded and question closed.

Netminder
CS Moderator
0

Featured Post

IT, Stop Being Called Into Every Meeting

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!

Join & Write a Comment

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 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