https://www.humansecurity.com/tech-engineering-blog/unload-and-beforeunload-events-and-how-to-easily-debug-them-both