Solved

Detecting when browser exits

Posted on 1998-09-27
8
180 Views
Last Modified: 2013-12-25
Hi,

I'm writing an ASP application that is accessing
a database. I need to be notified when a user closes the
browser (Netscape or IE) and write something to the database
when the browser is closed.

Additionally, I was trying to find a way to be notified when
a Session times out (a Session as defined by ASP).

Any ideas?
Thanks,
Ralph

0
Comment
Question by:rakhras
  • 4
  • 4
8 Comments
 
LVL 1

Accepted Solution

by:
quekky earned 50 total points
ID: 1855279
Session timeout is in the global.asa file
I think it's Session_close or something like that, check MS docs

as for detect when browser close, u could put <body onunload="openwin2myasp()">  so that a new window is opened then close and this function calls ur asp to do whatever u want

hopes u know what i'm talking...
0
 

Author Comment

by:rakhras
ID: 1855280
quekky,

That sounds good. However, the unload event is also triggered
when the Refresh or Reload buttons are pressed.
Do you know if there is any way of trapping when the
user presses the Refresh/Reload button?

Thanks,
Ralph
0
 
LVL 1

Expert Comment

by:quekky
ID: 1855281
if u are do programming in java, maybe u can do that
else i do not know of any way for the reload button
the other way is to wait for the session timeout
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:rakhras
ID: 1855282
quekky,

yes, i'm programming in java. How would you do it in Java?
0
 

Author Comment

by:rakhras
ID: 1855283
quekky, actually i mean i'm programming in java script.

0
 
LVL 1

Expert Comment

by:quekky
ID: 1855284
oh, sorry, even in java if u press reload the exit event will also be called
i think u use the session timeout and maybe the javascript i gave u
0
 

Author Comment

by:rakhras
ID: 1855285
quekky,

The issue with using the Session timeout events is that they are not called when you close the browser. They will eventually be called when the session expires but that's too late.

ralph
0
 
LVL 1

Expert Comment

by:quekky
ID: 1855286
oic, u have to use the javascript but your asp code need to detect if u press reload or close the browser
maybe on your main asp page u set a var1=1
in your exitbrowser asp page u set var1=0 then wait 30 secs and if var1 still =0 then the browser is really closed
just a suggestion, u can try it out
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question