When the user closes the browser tab, I am showing a dialog box with the help of "beforeunload" event. Following is the code I used.
window.onbefore