navigation

Prompting a user to confirm navigation away from a page using the "beforeunload" event in javascript

Submitted by charles on

To brush up on, and solidify my javascript knowledge, I'm currently going through the book "Eloquent Javascript", and came across the brief mention of "load" and "unload" events. I'm well aware of and use the "load" event all the time, but I haven't actually needed to use the "unload" event in any custom js code of mine before, so while the book doesn't really go into any detail I looked at the MDN's "beforeunload" documentation for some more info.