title: catch close browser with onunload function using master page in ASP.NET
body: <p>I have a website with master page. I want to catch a user trying to close the browser/tab. When I try using onunload in the body tag, it fires not only when I try closing the browser, but also when I navigate to another page.</p>
  
  <p>Any idea how to only catch the event of closing the browser?</p>