0

I have security problem that when user leave\close the window before logout, I want to show an alert message.

So that I did this:

window.onbeforeunload   = function(){  return " confirm msg";}

I get the alert, but now the problem is, if I click refresh button the default operation is to run without the alert message.

I got the answer for a keyboard but not for a mouse click. Can any one help me, with how to detect when the user clicks the refresh button?

If you have any suggestion please post...

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
k6t back
  • 87
  • 1
  • 8

1 Answers1

0

Unfortunately, there is no way you can tell if the onbeforeunload event is triggered by a refresh, close, etc.

xmarcos
  • 3,298
  • 2
  • 20
  • 27