Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Capture the event of closing IE

Reply
Thread Tools

Capture the event of closing IE

 
 
Uma Muthu
Guest
Posts: n/a
 
      11-08-2004
Hello Everyone,

How can I capture the event of closing the IE browser from within an ASP.NET
web application?

TIA,
Uma


 
Reply With Quote
 
 
 
 
=?Utf-8?B?VGFtcGEgLk5FVCBLb2Rlcg==?=
Guest
Posts: n/a
 
      11-08-2004
The only thing I could think of is using JavaScript to detect the window
closing and then have the JavaScript fire a server side event. I haven't
done this before so I am giving you some ideas. Try looking up now to fire
server side code from JavaScript and then the client side code for javascript
should be pretty easy to find to detect a window closing. Hope this helps

"Uma Muthu" wrote:

> Hello Everyone,
>
> How can I capture the event of closing the IE browser from within an ASP.NET
> web application?
>
> TIA,
> Uma
>
>
>

 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      11-08-2004
there is no foolproof method sort of providing your own browser. the browser
does not fire a close event that can be captured. you can get the page
unload, but this fires on every navigation.

-- bruce (sqlwork.com)


"Uma Muthu" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
| Hello Everyone,
|
| How can I capture the event of closing the IE browser from within an
ASP.NET
| web application?
|
| TIA,
| Uma
|
|


 
Reply With Quote
 
Ken Dopierala Jr.
Guest
Posts: n/a
 
      11-08-2004
Hi Uma,

Below is a reply I've posted in the past on this topic. Ken.

Hi,

As others have said this is a tricky issue. The odds of you getting a
succesful postback are 50/50 to say the best. I've had about a 95% success
rate doing this:

1. Capture the onbeforeunload event in your body tag.
2. Incorporate the WebService.htc.
3. When the onbeforeunload event fires run a function that uses the
WebService.htc to tell a web service.

The browser will close before you get a response back but, about 95% of the
time, your web service will get hit and the user can successfully be logged
out. Note, that using the latest IE and Windows XP you will achieve almost
100% results. This is sort of complicated until you get the hang of it. If
this isn't something you want to try then here is another suggestion to
improve your chances but it might seem clunky to the user:

Have a main page that the user browses to. To run your app, they click a
button or link and then you use window.open() to create a new browser
window. This is the window your app runs from. Don't ask me why, but the
success rate of a postback from onbeforeunload seems to be much higher for
browsers launched from javascript than from browsers launched by the user.
Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Uma Muthu" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello Everyone,
>
> How can I capture the event of closing the IE browser from within an

ASP.NET
> web application?
>
> TIA,
> Uma
>
>



 
Reply With Quote
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      11-08-2004
You may be able to take advantage of the client side OnClose event.
Here's more info:
http://www.mozilla.org/docs/dom/domr...dow_ref56.html

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Uma Muthu" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello Everyone,
>
> How can I capture the event of closing the IE browser from within an
> ASP.NET
> web application?
>
> TIA,
> Uma
>
>



 
Reply With Quote
 
Uma Muthu
Guest
Posts: n/a
 
      11-10-2004
Thanks everyone. I found this one on net ... Very similar to what Ken said
....

http://aspnet.4guysfromrolla.com/articles/101304-1.aspx

-Uma


"Ken Dopierala Jr." <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi Uma,
>
> Below is a reply I've posted in the past on this topic. Ken.
>
> Hi,
>
> As others have said this is a tricky issue. The odds of you getting a
> succesful postback are 50/50 to say the best. I've had about a 95%

success
> rate doing this:
>
> 1. Capture the onbeforeunload event in your body tag.
> 2. Incorporate the WebService.htc.
> 3. When the onbeforeunload event fires run a function that uses the
> WebService.htc to tell a web service.
>
> The browser will close before you get a response back but, about 95% of

the
> time, your web service will get hit and the user can successfully be

logged
> out. Note, that using the latest IE and Windows XP you will achieve

almost
> 100% results. This is sort of complicated until you get the hang of it.

If
> this isn't something you want to try then here is another suggestion to
> improve your chances but it might seem clunky to the user:
>
> Have a main page that the user browses to. To run your app, they click a
> button or link and then you use window.open() to create a new browser
> window. This is the window your app runs from. Don't ask me why, but the
> success rate of a postback from onbeforeunload seems to be much higher for
> browsers launched from javascript than from browsers launched by the user.
> Good luck! Ken.
>
> --
> Ken Dopierala Jr.
> For great ASP.Net web hosting try:
> http://www.webhost4life.com/default.asp?refid=Spinlight
> If you sign up under me and need help, email me.
>
> "Uma Muthu" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hello Everyone,
> >
> > How can I capture the event of closing the IE browser from within an

> ASP.NET
> > web application?
> >
> > TIA,
> > Uma
> >
> >

>
>



 
Reply With Quote
 
prash prash is offline
Junior Member
Join Date: Jun 2007
Posts: 5
 
      06-18-2007
Hi Steve,
i was wondernig about where to write the line
window.onclose = funcRef;



Quote:
Originally Posted by Steve C. Orr [MVP, MCSD]
You may be able to take advantage of the client side OnClose event.
Here's more info:
http://www.mozilla.org/docs/dom/domr...dow_ref56.html

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Uma Muthu" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello Everyone,
>
> How can I capture the event of closing the IE browser from within an
> ASP.NET
> web application?
>
> TIA,
> Uma
>
>
 
Reply With Quote
 
prash prash is offline
Junior Member
Join Date: Jun 2007
Posts: 5
 
      06-18-2007
Hi Steve,
i was wondernig about where to write the line
window.onclose = funcRef;

Can you please give some suggestions?

Thanks and Regards,
Prash



Quote:
Originally Posted by Steve C. Orr [MVP, MCSD]
You may be able to take advantage of the client side OnClose event.
Here's more info:
http://www.mozilla.org/docs/dom/domr...dow_ref56.html

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Uma Muthu" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello Everyone,
>
> How can I capture the event of closing the IE browser from within an
> ASP.NET
> web application?
>
> TIA,
> Uma
>
>
 
Reply With Quote
 
prash prash is offline
Junior Member
Join Date: Jun 2007
Posts: 5
 
      06-18-2007
Hi,

When i navigate to some other page(using Response.Redirect), even then the event "onbeforeunload" gets fired. But i just want it to get fired only when I close IE. Can someone please help?

Thanks and Regards,
Prash
 
Reply With Quote
 
 
 
Reply

Thread Tools

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to capture browser closing event with Javascript karthik juneni ASP General 1 03-30-2007 08:51 AM
Closing popup window when closing parent window? =?Utf-8?B?Vk1J?= ASP .Net 3 02-15-2007 08:29 AM
Closing the doors 15 minutes before closing. doofus Computer Support 12 06-11-2005 08:20 AM
Capture event when browser is closing Derek Javascript 2 06-29-2004 01:26 AM
Closing child window WITHOUT closing parent thomas Javascript 0 10-23-2003 04:10 PM



Advertisments