473,385 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Capture Alt+F4 event Using Javascript

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
1 8491
gits
5,390 Expert Mod 4TB
hi ...

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

kind regards
Jan 4 '08 #2

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

Similar topics

3
by: waisty vb.net rookie | last post by:
How do I make sure my program cannot be closed by using Alt + F4 -- Thanks for reading
0
by: Ron James | last post by:
I have a Dialog type form that starts a worker thread, allows the thread to update its progess and provides a Cancel button. Following advice from Chad Meyers in a recent posting, the worker...
0
by: Stefan | last post by:
Hy, a have an application and i must disable the follow combination of keys: ALT+F4 ALT+TAB CTRL+ALT+DEL CTRL+ESC. For ALT+F4 i can disable the conbination with: protected override...
3
by: Stefan | last post by:
Hy, i have an app and i must disable this combination: ALT+F4; CTRL+ALT+DEL; CTRL+ESC;ALT+TAB like this: i find something on Internet and i can block ALT+F4 protected override...
2
by: cashdeskmac | last post by:
I have written a small program and I want the user to close it down solely by clicking on a button. How can I disable the ALT+F4 method of closing the application down?
7
by: Nikki | last post by:
Hi, Can anybody help me, i want to prevent windows to close my winform of ..NET application, when user presses Alt+F4
5
by: freelancex | last post by:
Hi, Im new to this forum, and new to scripting in general. Im an ICT Technician for a high school and i am designing a Form in visual basic 2005. The intended purpose of the Form, is to prevent...
10
by: kpranjan1 | last post by:
Hi all, I want keyCode for (alt+F4). actually i want to end session whenever browser window is getting closed. it is working when we close window using close button(X). if any of you...
1
by: vimala5 | last post by:
code for closing a window using ALT f4 or pressing cross button using javascript
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.