How to convert the following Chrome extension to Manifest v3?

613 views
Skip to first unread message

SLAWI MAHDI

unread,
Oct 19, 2022, 11:10:42 AM10/19/22
to Chromium Extensions

I want to migrate an extension to the new manifest vesion but I am unable to convert the following files from manifest v2 to manifest v3

manifest.json

{
            "manifest_version": 2,
            "name": "Notetaking",
            "description": "Plugin to take notes in your browser.",
            "version": "1.0.0",
            "icons": {
                "16": "icons/16x16.png",
                "48": "icons/48x48.png",
                "128": "icons/128x128.png"
            },
            "background": {
                "scripts": [
                    "background.js"
                ] },
       
            "browser_action": {
                "default_icon": {
                    "48": "icons/48x48.png",
                    "128": "icons/128x128.png"
                },
                "default_title": "Notetaking",
                "default_popup": "popup.html"
            },
            "permissions": ["storage"]
        }

backgroun.js

//We are listening for someone who connects here
    chrome.extension.onConnect.addListener(function(port) {
        //Once they disconnect we know that the popup was closed
        port.onDisconnect.addListener(function() {
            //You can do what you want here :)
        });
    });

popup.js

//We connect to background.js, that's listenning for new connections, so that the knows when we close the popup
var port = chrome.extension.connect({name: "SNT"});

//When we're ready... :)
$(document).ready( function() {
    //We try to retrieve the information stored
    chrome.storage.local.get('SNT', function(items) {
        //We insert the information we've received, even if there's none
        $("#SNT").text(items.SNT);
    });

    //Every time we press a key, we save the information to storage
    $("#SNT").bind('keyup', function() {
        chrome.storage.local.set({ 'SNT': $(this).val() }, function(){});
    });
});


If you can help me please, i will be really grateful.

Stefan Van Damme

unread,
Oct 19, 2022, 12:40:40 PM10/19/22
to Chromium Extensions, mahd...@gmail.com
Hi there,

Follow this migrating to Manifest V3 documentation page:
That should help you to easily convert it from Manifest V2 to Manifest V3.

Thanks,
Stefan vd

SLAWI MAHDI

unread,
Oct 20, 2022, 5:10:06 AM10/20/22
to Chromium Extensions, stefa...@gmail.com
it works, thank you very much

Stefan Van Damme

unread,
Oct 20, 2022, 5:15:58 AM10/20/22
to Chromium Extensions, mahd...@gmail.com, Stefan Van Damme
Hi mahd,

You are welcome! I am glad to hear that.

Thanks,
Stefan vd

Reply all
Reply to author
Forward
0 new messages