[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Disable Hot Keys in Internet Explorer

Posted on 2004-09-03
3
Medium Priority
?
2,122 Views
Last Modified: 2008-01-09
I have a link which opens a new window.  The new window does not have the menu toolbar, standard buttons toolbar, and address toolbar.  I did this because I don't want the user to be able to refresh the page or hit the back button.  I had hoped eliminating these toolbars would prevent them from doing this.

However, the hot keys such as F5 (refresh) still work.

Can I disable the hot keys as well?

I read somewhere that you could do this in Netscape Navigator.  However, I am only interested in doing this in Internet Explorer.

I am primarily interested in the Refresh Hot Key, and the Back and Forward Hot Keys.  Maybe the Stop (Esc) Hot Key.

Thanks
0
Comment
Question by:FranzRinkleff
3 Comments
 
LVL 15

Expert Comment

by:justinbillig
ID: 11976965
use a modal dialog IE only

http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodaldialog.asp

window.showModalDialog( )

// -------------------------------------------------------------------------
      //  Name: OpenModalDialog
      //  Abstract: Open the specified page in a modal window
      // -------------------------------------------------------------------------
      function OpenModalDialog( strPage, intHeight, intWidth, objDialogArguments )
      {
            var objResult = 0;
            try
            {
                  var strDialogOptions = "" +
                              "border=thin;" +
                              "center=yes;" +
                              "dialogHeight=" + intHeight + "px;" +
                              "dialogWidth=" + intWidth + "px;" +
                              "help=no;" +
                              "maximize=no;" +
                              "minimize=no;" +
                              "status=no;";
                  objResult = window.showModalDialog( strPage, objDialogArguments, strDialogOptions );
            }
            catch( expError )
            {
                  alert( "ClientUtilities1.js::OpenModalDialog( ).\n" +
                              "Error:" + expError.number + ", " + expError.description );
            }
            finally
            {
                  // Return result
                  return objResult;
            }
      } // OpenModalDialog


heres a function i wrote to open modal dialogs
0
 
LVL 32

Accepted Solution

by:
ldbkutty earned 1000 total points
ID: 11976982
This is a code from mplungjan for disabling the 'function' keys:
http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20722410.html

<html>
<head>
     <title>Untitled</title>
</head>

<body>
<script>
keys = new Array();
keys["f112"] = 'f1';
keys["f113"] = 'f2';
keys["f114"] = 'f3';
keys["f115"] = 'f4';
keys["f116"] = 'f5';
keys["f117"] = 'f6';
keys["f118"] = 'f7';
keys["f119"] = 'f8';
keys["f120"] = 'f9';
keys["f121"] = 'f10';
keys["f122"] = 'f11';
keys["f123"] = 'f12';

saveCode=""
function myFunc(code) {
  alert('testing '+code)
}

document.onkeydown = function(){
 // Capture and remap F-key
  if(window.event && keys["f"+window.event.keyCode])  {
    saveCode=window.event.keyCode;
    window.event.keyCode = 505;
  }
  if(window.event && window.event.keyCode == 505) {
    // New action for keycode
    myFunc(saveCode)
    return false; // Must return false or the browser will execute old code
     }
}
</script>

</body>
</html>
0
 
LVL 1

Author Comment

by:FranzRinkleff
ID: 11977442
The link you provided from ldbkutty was just what I needed.  I also liked your example on how to disable the rest of the F keys.  

Thanks all,
Franz
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question