By Opera Software

From Opera 15 onward, Opera 11 & 12’s extension format is no longer supported, and instead, we’ve switched to Chromium’s extension model. Check out our new documentation for developing extensions for Opera 15 and higher and start building your own extensions.


The disabled attribute represents whether a menu item is visible in a context menu. If the value is false (default), the menu item will be displayed and is clickable, whereas if the value is true the item will not be displayed in the context menu.


Boolean false


In the following example, a menu item is created for translating the web page into English. The menu item is disabled (not visible) if the user's browser language is not set to English.

  The configuration file ('config.xml').
<?xml version='1.0' encoding='utf-8'?>
<widget xmlns="">
    <feature name="opera:contextmenus"/>
// The background process (e.g. index.html)

if ( {
  var menu =;
  // Create a menu item properties object
  var itemProps = {
    title: 'Translate page into English',
    onclick: function(event) {

  if (window.navigator.browserLanguage.indexOf('en') != 0) {
    itemProps.disabled = true;

  // Create a menu item with the specified properties
  var item = menu.createItem(itemProps);
  // Add the menu item to the context menu

This article is licensed under a Creative Commons Attribution 3.0 Unported license.


No new comments accepted.