« Documentation Home

opera.extension.onmessage

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 event is fired when a message is received from the BackgroundProcess. The source is a messagePort to the connecting environment.

Example:

// Both the following are valid ways of using onmessage
opera.extension.onmessage = function(event) {
  opera.postError('Message received: ' + event.data); 
};

// Note the "on" is removed from "onmessage" here
opera.extension.addEventListener('message', function(event) {
  opera.postError('Message received: ' + event.data); 
}, false);