I have a Google Chrome extension that I’m wanting to convert to an Opera extension. Part of the functionality is that the options page has a page action.
manifest.json:
{
"name": "Option Page Action",
"version": "0",
"manifest_version": 2,
"options_page": "options.html",
"background": { "scripts": [ "background.js" ] },
"page_action": {}
}
options.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="options.js"></script>
</head>
<body>
<p>
I have a page action in Google Chrome, but not in Opera.
</p>
</body>
</html>
options.js:
chrome.runtime.connect();
background.js:
chrome.runtime.onConnect.addListener(function(port) {
chrome.pageAction.show(port.sender.tab.id);
});
In Chrome, this works fine. In Opera, the page action doesn’t appear. Debugging shows that show(tabId)
is called, and doesn’t throw an error. But the page action doesn’t appear. Since Opera extensions are (for these purposes) the same as Chrome extensions, I don’t understand why there’s a difference, and how I can overcome it. Is there a way that I can have a page action on my options page?