I need to intercept this event, do some validations and maybe then cause a postback. In the end the browser should return to the page it was trying to return.
How can I do it? I can't even intercept the event, can someone help me please?
Hmm... not sure. I know you could intercept the Unload method of the DOM , but that gets raised when you move to a new page.
Check this link out: http://jeremiahgrossman.blogspot.com/2006/09/intercept-web-browser-back-button.html
However, I do think you're kinda stuck. I have never seen anything able to intercept a Back button press/Backspace key press. You can use JS to stop the Backspace button from going back... but :\
what I would do is put a "Back" link / button on your page in a spot where users can see it. In that button you can do your work.. but I'm not sure.
The Killer Ninja Coding Monkeys thank those that mark helpful posts as answers.
Thanks for your anwsers, I'll check them tomorrow, but for you information: I've set a flag in the session to lock some objects in my system, and I've to free them in some cases. But I'm have trouble with the back button.
But thanks for your help, I'll check the possibilites you wrote tomorrow and give you a feedback..
The unload event is your only chance, but I still think a perfect solution will be impossible. That event will get fired when they press the back button, but it will also get fired whenever the page redirects or refreshes. Any postback will fire the event.
Hope this helps! Please mark the helpful post(s) as Answer.
oscarfh
Member
23 Points
45 Posts
Intercept the back-button event
Oct 05, 2007 09:24 PM|LINK
Hi,
I need to intercept this event, do some validations and maybe then cause a postback. In the end the browser should return to the page it was trying to return.
How can I do it? I can't even intercept the event, can someone help me please?
thanks,
Oscar
RTernier
Contributor
4755 Points
1139 Posts
Re: Intercept the back-button event
Oct 05, 2007 10:13 PM|LINK
Hmm... not sure. I know you could intercept the Unload method of the DOM , but that gets raised when you move to a new page.
Check this link out: http://jeremiahgrossman.blogspot.com/2006/09/intercept-web-browser-back-button.html
However, I do think you're kinda stuck. I have never seen anything able to intercept a Back button press/Backspace key press. You can use JS to stop the Backspace button from going back... but :\
what I would do is put a "Back" link / button on your page in a spot where users can see it. In that button you can do your work.. but I'm not sure.
My Site | My Examples | My Blog
tabish82
Member
284 Points
61 Posts
Re: Intercept the back-button event
Oct 05, 2007 10:20 PM|LINK
Check this out ...
http://mehmoodbluffs.blogspot.com/
This might help you
Regards
Muhammad Tabish Sarwar
oscarfh
Member
23 Points
45 Posts
Re: Intercept the back-button event
Oct 08, 2007 03:24 AM|LINK
Hi, sorry for the delay, i was travelling.
Thanks for your anwsers, I'll check them tomorrow, but for you information: I've set a flag in the session to lock some objects in my system, and I've to free them in some cases. But I'm have trouble with the back button.
But thanks for your help, I'll check the possibilites you wrote tomorrow and give you a feedback..
Thanks,
Oscar
oscarfh
Member
23 Points
45 Posts
Re: Intercept the back-button event
Oct 08, 2007 12:23 PM|LINK
Hi, it is raised even if you move to a page using the back button?
thanks
JoshStodola
Star
13736 Points
3177 Posts
Re: Intercept the back-button event
Oct 08, 2007 03:50 PM|LINK
The unload event is your only chance, but I still think a perfect solution will be impossible. That event will get fired when they press the back button, but it will also get fired whenever the page redirects or refreshes. Any postback will fire the event.
Hope this helps! Please mark the helpful post(s) as Answer.
oscarfh
Member
23 Points
45 Posts
Re: Intercept the back-button event
Oct 08, 2007 08:55 PM|LINK
Hi, Thanks,
Someone solved the problem today, but I don´t know what he did...
I think he used the unload to force the post, as you said.
Thanks,
Oscar