Solved

Detecting when browser exits

Posted on 1998-09-27
8
179 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
 

Author Comment

by:rakhras
ID: 1855282
quekky,

yes, i'm programming in java. How would you do it in Java?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
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…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

863 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now