# Detect browser close

**URL:** https://forum.kirupa.com/t/detect-browser-close/292996
**Category:** Uncategorized
**Created:** [July 21, 2009, 9:08pm UTC](https://forum.kirupa.com/t/detect-browser-close/292996 "2009-07-21T21:08:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![luoruize](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@luoruize](https://forum.kirupa.com/u/luoruize)
#### Post date: [July 21, 2009, 9:08pm UTC](https://forum.kirupa.com/t/detect-browser-close/292996/1 "2009-07-21T21:08:28Z")

</div>

Hey,  
I’m looking for some way to perform some action when the user closes the web-page in which the SWF is playing (basically, I need to log a player out of the system if he closes the page or tab). I read that it should be possible using ExternalInterface, but I couldn’t make it work. I’d appreciate it if someone could just show me a comprehensible JS and AS3 code that works, or tell me if there’s some other solution.

Thanks!
