Solved

Disable Hot Keys in Internet Explorer

Posted on 2004-09-03
3
2,092 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 250 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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

688 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