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.


This method can be used by to override global variables defined by regular scripts in a page.


  • name: String giving the name of the variable to be overridden.
  • getter: Function to be run whenever a script attempts to access the contents of the variable. Any value returned by the function is used as the value of the variable. The function receives the current value of the variable as parameter.
  • setter: Optional function to be run whenever a script attempts to set the value of the variable. The value that the script was attempting to assign to the variable is passed to the function as parameter. If no setter function is required, the value null must be used instead.


void defineMagicVariable (<DOMString> name, <Function> getter, <Function> setter)


window.opera.defineMagicVariable('isGoodBrowser', function (curVal) {
  return true;
}, function (newVal) {
  if (!newVal) {
    window.status = 'Repairing script';

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


No new comments accepted.