You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.
Simply changing the manifest_version in the manifest file from 2 to 3 was not enough to resolve the issue. Apparently, the background.scripts array has been replaced by a background.service_worker object. And making that change wasn't sufficient to get it working either, I assume because there is a fundamental difference between a background script in v2 and a background service worker in v3.
Please update the Opera extension documentation to reflect the changes from manifest v2 to v3. This should apply not just to the basics.md file but also to any other references to the manifest and to anything else that has changed between v2 and v3 (eg the description of background processes in the architecture-overview.md and getting-started.md files).
The text was updated successfully, but these errors were encountered:
After looking into the Chrome documentation about migrating to Manifest V3, https://developer.chrome.com/docs/extensions/migrating/, I was able to modify the manifest file and the background script to get them working. I suggest changing the code in the basics page as follows:
The Manifest file. Note the manifest_version is 3, background.service_worker has replaced background.scripts (and it's a single object, not an array), and action has replaced browser_action:
{
"manifest_version": 3,
"name": "Opera Extensions — Getting Started",
"description": "Sample extension for the “Making your first extension” article",
"version": "1.0",
"background": {
"service_worker": "service-worker.js"
},
"permissions": ["tabs"],
"action": {
"default_icon": "icon.png",
"default_title": "Go to Dev.Opera!"
}
}
Rename the background.js file to service-worker.js and change the code to replace chrome.browserAction... with chrome.action... :
I also suggest adding a note about how to display the icon on the toolbar by pinning it via the Extensions button. As someone brand new to extensions I assumed the icon wasn't displaying because there was a problem in my extension manifest or code. I eventually discovered icons aren't displayed by default. I think a couple of sentences explaining this could avoid a lot of angst among newbies like me.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I tried following the instructions for creating a sample Opera extension at https://dev.opera.com/extensions/basics/. This seems to correspond with the basics.md file in the _extensions src folder, https://github.com/operasoftware/devopera/blob/master/src/_extensions/basics.md. The instructions are for creating a v2-style manifest with a background script.
When I clicked the "Load Unpacked" button on the Opera Extensions page I got the following error:
Simply changing the manifest_version in the manifest file from 2 to 3 was not enough to resolve the issue. Apparently, the background.scripts array has been replaced by a background.service_worker object. And making that change wasn't sufficient to get it working either, I assume because there is a fundamental difference between a background script in v2 and a background service worker in v3.
Please update the Opera extension documentation to reflect the changes from manifest v2 to v3. This should apply not just to the basics.md file but also to any other references to the manifest and to anything else that has changed between v2 and v3 (eg the description of background processes in the architecture-overview.md and getting-started.md files).
The text was updated successfully, but these errors were encountered: