# Detecting flash/html window closed

**URL:** https://forum.kirupa.com/t/detecting-flash-html-window-closed/212219
**Category:** Uncategorized
**Created:** [January 9, 2007, 1:28pm UTC](https://forum.kirupa.com/t/detecting-flash-html-window-closed/212219 "2007-01-09T13:28:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![System\_Idle](https://avatars.discourse-cdn.com/v4/letter/s/43a26b/32.png) [@System\_Idle](https://forum.kirupa.com/u/System_Idle)
#### Post date: [January 9, 2007, 1:28pm UTC](https://forum.kirupa.com/t/detecting-flash-html-window-closed/212219/1 "2007-01-09T13:28:23Z")

</div>

Hi

is it possible for flash to detect when a user closes an html window with a swf embeded in it?

I want to record a user session time and need to be able to call a function and serverside script from within flash when a user closes the window…is there a way?

(I thought I might be able to do it with onUnload, but that will only work for unloading movieclips, not closing the main swf.)

thanks for your help
