Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE back button.

Status
Not open for further replies.

Premalm

Programmer
Mar 20, 2002
164
US
Hi Guys,

Is it possible to capture the IE back button event by using the server side coding ?

Any Ideas

Premal
 
Not really no. What are you trying to do?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I am working on a asp.net application. What I want is when the user clicks the back button I want to show a message box warning them that "You need to click save otherwise your data will be lost".

I know we can use the onqueryunload event to show a messagebox but we do not want to show the messagebox if there is no change.
What I did is I get the current value in the onfocus event and set a flag on the onblur event if the current value is not equal to the value taken from onfocus event. This is working fine.

The problem is when the back button is clicked onblur event does n't trigger. So the IE navigation window is not shown.

Any ideas.

Thanks
Premal
 
ca8msm: just a tidbit from a post by Link99 sometime back; he said he would place the javascript function:

history.go(1);

on every page to prevent the action of the backbutton - perhaps there is a way to capture through this java event additional javacode to carry out the requisite plan. Just a thought.
 
once you start messing with the back button you will get messages like page expired etc. I had this problem as well and the bottom line for me was to just train the users to save there changes. I guess you could disable your save button and try and capture key press events. Now I don't know if that's the best way in asp.net. I used to do that in VB. I would have a save button that was disabled on the form then once a key was pressed the button would then get enabled. if the user tryed to exit the form that's when they would get the message asking them to save changes. you may be able to get something like to work in asp.net but I'm not sure.

try the java forum..they may be able to help you.

 
ca8msm: just a tidbit from a post by link99 sometime back; he said he would place the javascript function:

history.go(1);
Don't ever do that. You shouldn't force the user's browser to do anything that it isn't supposed to do otherwise you will just end up losing your users.

If you want to inform the user that if they click back then their data will be lost, then simply do this on the page and make it a prominant message.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
We are going to inform users that if they click the back button they should save before doing that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top