Is there a way to capture whether the user clicked OK or CANCEL?
I need to do something ONLY if the user is leaving the page....
No, browsers allow you to only specify the text in the alert box, but no way to catch the result.