Window. onbeforeunload = function () // Author: meizz
{
VaR n = Window. event. screenx-window. screenleft;
VaR B = n> document.doc umentelement. scrollWidth-20;
If (B & window. event. clienty <0 | window. event. altkey)
{
Window. open (". /. aspx "," logout "," toolbar = No, scrollbars = No, resizable = No, top = 0, Left = 0, width = 10, Height = 10 ");
// Window. event. returnvalue = "warning this operation is not safe! "; // The operation code you Want to do can be placed here
}
}
This event will be triggered during refresh and exit.
So we need to determine whether to refresh or disable the "Red Cross" exit.
VaR n = Window. event. screenx-window. screenleft;
VaR B = n> document.doc umentelement. scrollWidth-20;
If (B & window. event. clienty <0 | window. event. altkey) {the event to be triggered can be written here}
This will determine whether the exit is true.