473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Any way to identify/capture back button event? (Con'd)

Hi,

I have a question which is related to an old question submitted in this forum but was not fully answered.

The original question is at Any way to identify/capture back button event? .

Does anyone can help adjusting the solution to support
(1) firefox (currently it fails - onload/onunload goes into infinite loop since onunload is being called right after location.reload (unlike IE)
(2) avoid the browser popup message alerting about re-submitting HTTP post request

I am sorry if this is a dumb question, I am new to javascript and I tried solving it for few days with no use.

Thanks
Jun 21 '07 #1
6 13062
acoder
16,027 Expert Mod 8TB
yosicco, welcome to TSDN!

You need to use onbeforeunload instead. See this link.
Jun 22 '07 #2
yosicco, welcome to TSDN!

You need to use onbeforeunload instead. See this link.
Thanks a lot ACoder - it works!!! :)

I have one problem left, since I'm using HTTP POST request, when I click the back button a warning message of the browser is being displayed (something like "To display the web page again, Internet Explorer needs to resend the information you've previously submitted...") - In my case the re-post is completely harmless and I would like to eliminate this message - is there a way to eliminate it?

Thanks again,
yossico
Jun 24 '07 #3
acoder
16,027 Expert Mod 8TB
Thanks a lot ACoder - it works!!! :)
It's non-standard, but it works in most browsers, I think.

I have one problem left, since I'm using HTTP POST request, when I click the back button a warning message of the browser is being displayed (something like "To display the web page again, Internet Explorer needs to resend the information you've previously submitted...") - In my case the re-post is completely harmless and I would like to eliminate this message - is there a way to eliminate it?
There is the PRG (Post, Redirect, Get) approach. It's discussed in The only thing to fear of the back button...is fear itself - see the related links too.
Jun 25 '07 #4
It's non-standard, but it works in most browsers, I think.


There is the PRG (Post, Redirect, Get) approach. It's discussed in The only thing to fear of the back button...is fear itself - see the related links too.
Again, thanks alot acoder for your swift reply.

I am afraid I will not be able to change the architecture of the application to use redirect/HTTP GET (at least not without significant development cost).

Is this the only way to eliminate the warning message of browsers?

Thanks.
Jun 25 '07 #5
acoder
16,027 Expert Mod 8TB
Again, thanks alot acoder for your swift reply.

I am afraid I will not be able to change the architecture of the application to use redirect/HTTP GET (at least not without significant development cost).

Is this the only way to eliminate the warning message of browsers?

Thanks.
I'm sorry - not that I'm aware of.
Jun 25 '07 #6
You can do this with javascript. You need to get a little creative but it works. You might be able to work this into your POST.

http://www.dmcinfo.com/Blog/articleT...-Snippets.aspx
Aug 11 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Niels Peter Heick | last post by:
Is there a way to capture the Back Button when it is clicked via the IE. I am developing a ASP.NET page and I need to know when users click on the Back button. After the event from the back...
1
by: honcho | last post by:
Hello: Is there a way to induce an event from the user's clicking the browser BACK button? I need to be able to execute some server-side code before the user interacts with the "previous" web...
3
by: Vivek | last post by:
Hi all, I have a problem in my web-app wherein I need to get the latest page from server on clicking of back button.. I know that it can be done by preventing/disabling the cache in jsp as ...
2
by: sharonrao123 | last post by:
product page has datalist control with paging implemented by gridview control, ProductDetail is the second page with back button which will take the user to the previous page. The problem is when i...
1
by: karthik juneni | last post by:
Hi all, Iam trying to capture windows closing event (i.e) when the user clicks on the "X" button i want to capture that event and want to update some values in the database.I tried two methods...
1
by: bravo | last post by:
hi using javascript i am able to capture the backspace key and also to disable it but it is not working for the back button on the toolbar. i am new to javascript have searched a lot but didnt...
20
by: bhappy | last post by:
Hi All, Is there any way to find the event is browser back button click? I need to show an alert when user clicks on browser back button? I tried using the following code but alert is showing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.