When we press ESC, browser’s server connection would break unless another request such as user input or ajax request.
My problem is that when I press ESC while I am uploading the file into server, my upload do not process further(It hanged).
But I need to press ESC for some feature of my page. Such as,
- Pressing ENTER for rename and ESC for ignoring rename.
- Pressing ESC to cancel the message box, etc.
How do I write JavaScript to prevent the breaking of connection when we press ESC.
Let the Two functions for ignoring rename and canceling message box be
cancelRename();andcancelMsgBox();Now check for ESC press on your browser by this script;
Note:
Function
cancelRename();andcancelMsgBox();will always called when you press ESC. Thus you have to manage that yourself.Hints: