First on the API checklist in the migration guide:
Do you have host permissions in your
permissions
oroptional_permissions
arrays inmanifest.json
? Move host permissions into thehost_permissions
field.
Here's our V2 manifest, with old-school host permissions inside the permissions
field, which would also hold other API permissions like storage
, if we were using any:
{
"version": "0.0.102",
"name": "Baseline",
"description": "Manifest V2 Baseline",
"permissions": ["*://*/*"],
"content_scripts": [
{
"js": ["js/content.js"],
"matches": ["*://*/*"]
}
],
"manifest_version": 2
}
Here's our V3 manifest, with our host permissions request moved into the new host_permissions
field:
{
"version": "0.0.102",
"name": "Test",
"description": "Manifest V3 Test",
"host_permissions": ["*://*/*"],
"content_scripts": [
{
"js": ["js/content.js"],
"matches": ["*://*/*"]
}
],
"manifest_version": 3
}
Here's our tiny content script for Manifest V2, saved as ep_002/v2/js/content.js
:
console.log("Content script has loaded via Manifest V2.");
Here's our tiny content script for Manifest V3, saved as ep_002/v3/js/content.js
:
console.log("Content script has loaded via Manifest V3.");
Load by dragging ep_002/v2
and ep_002/v3
into chrome://extensions
. Both of these will run in Chrome Canary, so you don't (yet) need to be running two browsers side-by-side.
Check for errors (yes, the Manifest V3 version will still squawk about that 3 in manifest_version
not being supported).
Open a new page, inspect, go to your Console tab, and see if you see these two lines:
Content script has loaded via Manifest V2.
Content script has loaded via Manifest V3.
Seems good.