beforeunloads

occurs before the document is about to be unloaded