When I close the browser window by pressing the "X" button in the top right corner, I need to call my logout.aspx page. I need a solution that works in all browsers and should work only when the "X" button in the top right corner of the browser window is pressed . Tried everything with onbeforeunload , but nothing seems to work in chrome. Any sample code would be greatly appreciated
!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript"> function test() { window.open('https://forums.asp.net/t/2161554.aspx') } </script> </head> <body onbeforeunload="test();"> <form id="form1" runat="server"> <div> </div> </form> </body> </html>
onunload
onbeforeunload
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)