Show warning message before close window in Java Script

前端 未结 1 1398
抹茶落季
抹茶落季 2020-12-05 20:38

I\'ve try this:

 

and the function is:

function LogoutNoAsk()
{
    al         


        
相关标签:
1条回答
  • 2020-12-05 20:48

    You're actually wanting to use the onbeforeunload event which allows you to block the close event.

    See the MDN reference for details, but the code required would be:

    window.onbeforeunload = function(e) {
        return 'Please press the Logout button to logout.';
    };
    
    0 讨论(0)
提交回复
热议问题