Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

kickoff script when browser closes

Status
Not open for further replies.

OhioSteve

MIS
Mar 12, 2002
1,352
US
I want a script to start when either of these things happen:

1) The user closes this tab.
2) The user closes this instance of their browser.

How can I do that? I found a list of javascript events( Unfortunately, I don't see anything like "onTabClose" or "onBrowserQuit".
 
onunload happens whenever the page changes. I want to run my script ONLY if the user closes the browser instance or the current browser tab.
 
If the user simply follows a hyperlink the script should not run.
 
Hi

However you can mess abit to achieve something similar.
[ul]
[li]Set [tt]onunload[/tt] on the [tt]window[/tt] object.[/li]
[li]Set [tt]onclick[/tt] on all [tt]a[/tt] element. In the [tt]onclick[/tt] handler remove the [tt]onunload[/tt] listener.[/li]
[/ul]
No idea what you will achieve that way...

Feherke.
 
Actually, it only needs to work with IE7. This is an Intranet application, and I work with the users every day.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top