Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.
reserved
Type: string
This attribute applies to a command element.
If set to "true", it indicates that the command is reserved for Chrome code and is not available to content. This means that to execute these commands, key events won't be passed to content, and event listeners registered for them in content will not be executed.
Currently, content still receives these key events, though it can't override them. In future releases, it won't receive them. See bug 1173061 for details.

Example

Here, the command to open a new browser window is reserved:

<command id="cmd_newNavigator" oncommand="OpenBrowserWindow()" reserved="true"/>

If the keyboard shortcut for that is accel-t, then this code will not work as expected, as compared to when it is run from web content:

document.addEventListener("keydown", handleKey, true);

function handleKey(event) {
  // Listen for the "New Tab" shortcut
  if (event.metaKey && (event.key == "t")) {
      // Log a message
      console.log("intercepted accel-t");
      // Prevent the default browser action
      event.preventDefault();
      event.stopPropagation();
  }
}

Currently, this event handler as coded above runs and logs the message, but the default behavior persists. In future releases, the event handler will never be called for the given keyboard shortcut.

 

Document Tags and Contributors

 Contributors to this page: rolfedh, PushpitaPikuDey, Dipesh01, openmando, wbamberg
 Last updated by: rolfedh,