devopera icon indicating copy to clipboard operation
devopera copied to clipboard

Message passing to extensions from webpages

Open Justineo opened this issue 10 years ago • 0 comments

The docs on Dev.Opera says:

From the web page, use the runtime.sendMessage or runtime.connect APIs to send a message to a specific app or extension. For example:

// The ID of the extension we want to talk to
var editorExtensionId = '<sample extension id>';

// Make a simple request
chrome.runtime.sendMessage(editorExtensionId, { openUrlInEditor: url },
  function(response) {
      if (!response.success) {
          handleError(url);
      }
  }
);

But in Opera chrome.runtime is actually undefined so the method provided by the doc is not working. I don't know if the doc here is still correct.

F.Y.I. I'm using Opera v35.0.2066.37 on OS X.

Justineo avatar Feb 04 '16 15:02 Justineo