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.
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';
}
});