I watched a few threads here,mostly used this: window.onbeforeunload = function (e) { var e = e || window.event;
//IE & Firefox if (e) { e.returnValue = 'Are you sure?'; }
// For Safari return 'Are you sure?'; };
but seems this will mix the situation of refreshing page and close page, is there any possibility to distinguish these two situations?