1

I am pretty new to javascript. I want to give some action only when close the browser. I used below jquery function to give an action when close the browser, but this function gives an action when moving to another page or refresh the page. Can I give an action only when an user clicks the X button or close the browser?

Please Help, thank you..

$(window).bind("beforeunload", function (e){

    return "close window?";

});
john
  • 39
  • 3
  • 1
    I'm affraid it's not possible, see [this answer](https://stackoverflow.com/a/3888938/16688813). – Tom Nov 26 '21 at 08:44

0 Answers0