Results 1 to 1 of 1

Thread: Disable browser F1 and replace with own content

  1. #1
    Join Date
    Aug 2009
    Thanked 0 Times in 0 Posts

    Default Disable browser F1 and replace with own content

    1) CODE TITLE: Disable browser F1 and replace with own content (cross browser compatible)

    2) AUTHOR NAME/NOTES: Phill Moore, Regent Internet (

    3) DESCRIPTION: For site specific help, particularly browser based applications - this script disables the standard browser help and allows you to do your own thing. Tested and works in FF 3.0.13, IE 7, Opera 9.63, Safari 3.2.2, Google Chrome 2. I use with DHTML Window Widget v1.1 from Dynamic Drive to bring up my own help box.

    4) URL TO CODE:
    URL to live example:

    or, ATTACHED BELOW (see #3 in guidelines below):

    // disable MSIE standard help function
    document.onhelp = new Function("return false;");
    window.onhelp = new Function("return false;");
    // get key stroke for Firefox, Opera, Google Chrome
    document.onkeypress = keyHit;
    // get key stroke for MSIE, Safari
    var browser=navigator.userAgent;
    if (|safari/i) != -1) document.onkeydown = keyHit;
    // keystroke handling
    function keyHit(event) { 
        // get correct keycode depending on browser
        var keyStruck;
        if (|safari/i) != -1) keyStruck = window.event.keyCode; else keyStruck = event.keyCode;
        if (keyStruck == 112) {
          if ( == -1) {    // disable browser standard help function for all but MSIE (see above for MSIE)
          keyAction('help');     // call routine to replace standard help function
        // You can add the capture of other keystrokes here
    // replacement help function
    function keyAction(action) {
      if (action == 'help') {
        // Your new help function goes here
        // I have used in conjunction with DHTML Window widget (v1.1) from Dynamic Drive to deliver a new help file  
      // You can add the actions for other keystrokes here
    Last edited by redphill; 08-27-2009 at 12:43 PM. Reason: added url


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts