Solved

Detecting when browser exits

Posted on 1998-09-27
8
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Turn Insights Into Action

You’ve already invested in ITSM tools, chat applications, automation utilities, and more. Fortify these solutions with intelligent communications so you can drive business processes forward.

With xMatters, you'll never miss a beat.

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will learn how to count occurrences of each item in an array.
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.

690 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