Solved

Detecting when browser exits

Posted on 1998-09-27
8
182 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 

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

How our DevOps Teams Maximize Uptime

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

Question has a verified solution.

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

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.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
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…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

829 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