Possible Duplicate:
How can I ask a web user for confirmation if he really wants to leave the page?
When I am writing an answer to something on SE, I commonly stumble on my back button (which is annoyingly positioned next to my arrow keys) which takes me back a tab, on other websites, losing all the text I just types.
However on SE, when I am about to leave a page, it creates a pop-up to ask if I really intended on doing this, which is super useful.
How is this implemented?