The SANS ISC diary today is mentioning a javascript function present in today's browsers called onUnload().
Features and the security point of view
The SANS ISC diary today is mentioning a javascript function present in today's browsers called onUnload().