How does StackOverflow do this when you add a question or answer a question;
I would like to request from the user:
"Are you sure you want to navigate away from this page" "Press OK to continue or Cancel to stay on this page"
I tried a couple of js fragments that I found on the Internet, but nothing cuts the mustard.
source share