21 Sep 2010

Why do websites block the ALT key ?

While browsing this site yesterday, I pressed the ALT+D combo to focus on the address bar and was greeted by a “You don’t have permission” warning.

I examined the code and found the javascript snippet responsible for this behaviour.

if (k.keyCode==18 || k.keyCode==93)
{
  alert ("Sorry, you do not have permission to press this key.")
  return false;
}

The keys 18 and 93 correspond to ALT and the “Win Property” key. I don’t use the Win Property too often, but blocking the ALT seems completely unreasonable. Off the top of my head itself I can list the following ALT based shortcuts for Google Chrome.

Except ALT+Tab, which works after an annoying popup, the rest fail.