Is there any way to have some action performed when the browser close button is clicked?

评论

2 条评论

  • Avatar
    Suhail Faisal

    Hi Gwen,

    You can try the below javascript to show a popup confirmation while closing the browser tab

    var popit = true;
    window.onbeforeunload = function()
    {
    if(popit == true)
    {
    popit = false;
    return "Are you sure you want to leave?";
    }
    }
    0
    评论操作 固定链接
  • Avatar
    Gwen Wilson

    Thank you! This worked perfectly!

    0
    评论操作 固定链接

请先登录再写评论。