« Documentation Home

opera.defineMagicVariable()

This documentation relates to Opera's now deprecated .oex Extension API framework for Opera versions <= 12.15 and also provided by our OEX2NEX shim library.

For the latest Opera Extensions API documentation for Opera versions > 12.15 please consult the latest Opera Extensions API documentation online.

Description:

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

Parameters:

Syntax:

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

Example:

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