Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-16-2010, 11:23 AM   PM User | #1
Mahendra.Ph
New to the CF scene

 
Join Date: Jul 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Mahendra.Ph is an unknown quantity at this point
Question How to detect browser Refresh or Close?

In my application I want user to take an "Exit Survey"(Independent website) when he is leaving the application. As name explains, It should happen only when user closes current browser tab or browser window. Its possible using JavaScript OnUnload event. But the problem is that this event occurs on

1. close of browser tab
2. close of browser window
3. click of any internal page link(i.e anchors and form buttons)
4. click of browser's Refresh button
5. click of browser's Back/Forward button

I have handled first 3 cases but not able to detect Refresh and Back/Forward button click.
Has anybody of you implemented such functionality??

Thanks in advance!!!
Mahendra.Ph is offline   Reply With Quote
Old 07-28-2010, 05:31 PM   PM User | #2
DevonHartigan
New to the CF scene

 
Join Date: Jul 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
DevonHartigan is an unknown quantity at this point
Trust me on this one. It is simply not possible. I have recently tried to do pretty much the exact same thing, and researched this topic.

It cannot be done. Period. I ended up with your 3 first points too.

There is no way to detect if a user press the refresh or back navigation button.
DevonHartigan is offline   Reply With Quote
Old 07-28-2010, 05:37 PM   PM User | #3
DevonHartigan
New to the CF scene

 
Join Date: Jul 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
DevonHartigan is an unknown quantity at this point
You can also see:

http://stackoverflow.com/questions/2...d-via-a-refres

and

http://stackoverflow.com/questions/1...ad-event-as-it
DevonHartigan is offline   Reply With Quote
Reply

Bookmarks

Tags
broswer refresh

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:04 PM.


Advertisement
Log in to turn off these ads.