Current location: Hot Scripts Forums » General Web Coding » JavaScript » browser close event?


browser close event?

Reply
  #1 (permalink)  
Old 10-01-06, 04:02 AM
daivagna daivagna is offline
Newbie Coder
 
Join Date: Sep 2006
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
browser close event?

can anybody will tell me how to capture browser close event? if i use ononload event..then prob. is it is getting fired on refrashing the browser..i have used window.close() it is cool but how to get which button use has pressed..i mean window.close() alert us with yes or no whther u wanna close or not i wanna to get that vakue...my purpose is to abendone the session if some1 press yes..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-01-06, 04:47 PM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
There is no such event.
The alert you get when closing a page which has not been opened by JavaScript does not return anything, (it's not scriptable since it's a security measure) so it's not possible to know which button was pressed.

You could make the client poll your server every minute or so to tell the server it's still there. Kinda like what Gmail does when it asks the server for new mail using httpRequest.
But that would generate extra traffic, and you'd still need a timeout of some sort. And scripting might be disabled on the client, fooling your server into thinkin that the client has already closed the window...

And so on...
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
browser close event? daivagna ASP.NET 4 10-01-06 08:50 AM
redirect - firefox browser chrisrobertson JavaScript 3 05-12-06 06:37 PM
Browser : Back, Forward & Close RaceWorks JavaScript 1 11-16-04 04:59 PM
Session or anything else require close window event? webFani PHP 2 04-15-04 12:43 AM
Confirm on close? Icarus JavaScript 6 01-31-04 06:59 PM


All times are GMT -5. The time now is 06:47 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.