I want to disable ALT+F4 from working closing the page in asp.net
how can i do this in javascript or code behinde (C#) ??
Thanks
Hi,
It is not possible to disable Alt+F4 using javascript instead of that you can use onbeforeunload
Please refer below code.
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> window.onbeforeunload = function () { return "your message"; } </script> </head> <body> </body> </html>
Demo
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.