Internet shorcuts and Javascript

Apr 28, 2022

Hello everyone, I'm using Storyline to teach about keyboard shortcuts in another software.
I've been using Javascript in order to disable the internet shortcuts. However, some shortcuts still works. The one that poses me a problem is Ctrl+T, as it opens a new tab in the browser.

My current code is : 

document.onkeydown=disableKeys;
var version = navigator.appVersion;

function disableKeys(e) 
{   var keycode = (window.event) ? event.keyCode : e.keyCode;

    if ((version.indexOf('MSIE') != -1)) 
    {  if (keycode != 0) 
       {  event.keyCode = 0;
          event.returnValue = false;
          return false;
       }
    }
    else 
    {  if (keycode != 0) 
          return false;
    }
}

I know little to no Javascript so this code is made of pieces scrapped together with my understanding. If anyone know of a solution using either javascript or anything else, it would help me a lot.

Be the first to reply