By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,131 Members | 1,437 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,131 IT Pros & Developers. It's quick & easy.

Capture Alt+F4 event Using Javascript

P: 1
Hi Guys,

I want to execute script function for the following conditions ,
1. when user press Alt+F4 key
2. from taskbar->rightclick-> close the browser option.
But My html dosn't contains <BODY> tag.
So, I implemented window closing for X button(Its fine). The code shown in bellow.
It helps you to solve my issue
Expand|Select|Wrap|Line Numbers
  1.  
  2. <script>
  3.     window.onunload=function1;
  4.  
  5.     function1= function() {
  6.         if (event.clientY < 0){
  7.             //alert("call another function");
  8.         }
  9.  
  10.         // Need code for Alt+F4 same as above
  11.         // Need code for mouse right click event  
  12.     } 
  13. </script>
Please help me to solve this issue. Its very urgent.
Let me know , if u have any issues.([edit])
Regards,
Srinivas
Jan 4 '08 #1
Share this Question
Share on Google+
1 Reply


gits
Expert Mod 5K+
P: 5,333
hi ...

try 'onbeforeunload' ... that should be called in any case you want to have captured ...

kind regards
Jan 4 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.