Software

How to Get Extension Manifest Information


Working on a web extension can be kinda wild — on one side you’re essentially just coding a website, on the other side you’re limited to what the browser says you can do in the extension execution environment. One change in that environment is coming January 2023 — pushing extensions to move to manifest version 3. I recently got curious about whether other popular extensions had completed the version 3 update.

Executing the following command in the background page (manifest version 2) or service worker (version 3) will provide you the extension’s manifest:

chrome.runtime.getManifest()

The getManifest call returns a large object detailing the extension’s manifest. Here’s what you’d see for the MetaMask browser extension:

{
    "author": "https://metamask.io",
    "background": {
        "page": "background.html",
        "persistent": true
    },
    "browser_action": {
        "default_icon": {
            "16": "images/icon-16.png",
            "19": "images/icon-19.png",
            "32": "images/icon-32.png",
            "38": "images/icon-38.png",
            "64": "images/icon-64.png",
        },
        "default_popup": "popup.html",
        "default_title": "MetaMask"
    },
    "commands": {
        "_execute_browser_action": {
            "suggested_key": {
                "chromeos": "Alt+Shift+M",
                "linux": "Alt+Shift+M",
                "mac": "Alt+Shift+M",
                "windows": "Alt+Shift+M"
            }
        }
    },
    "content_scripts": [
        {
            "all_frames": true,
            "js": [
                "disable-console.js",
                "globalthis.js",
                "lockdown-install.js",
                "lockdown-run.js",
                "lockdown-more.js",
                "contentscript.js"
            ],
            "matches": [
                "file://*/*",
                "http://*/*",
                "https://*/*"
            ],
            "run_at": "document_start"
        }
    ],
    "current_locale": "en_US",
    "default_locale": "en",
    "description": "An Ethereum Wallet in your Browser",
    "externally_connectable": {
        "ids": [
            "*"
        ],
        "matches": [
            "https://metamask.io/*"
        ]
    },
    "icons": {
        "16": "images/icon-16.png",
        "19": "images/icon-19.png",
        "32": "images/icon-32.png",
        "38": "images/icon-38.png",
        "48": "images/icon-48.png",
        "64": "images/icon-64.png",
    },
    "manifest_version": 2,
    "minimum_chrome_version": "66",
    "name": "MetaMask",
    "permissions": [
        "storage",
        "unlimitedStorage",
        "clipboardWrite",
        "http://localhost:8545/",
        "https://*.infura.io/",
        "https://lattice.gridplus.io/*",
        "activeTab",
        "webRequest",
        "*://*.eth/",
        "notifications"
    ],
    "short_name": "MetaMask",
    "update_url": "https://clients2.google.com/service/update2/crx",
    "version": "10.16.1"
}

Many of web extensions are still using manifest version 2, so many extension developers are pushing to finish manifest version 3 work!



Source link
Show More

admin

Makes Noise is a blog where you can find all the juicy details on a variety of topics including health and fitness, technology, lifestyle, entertainment, love and relationships, beauty and makeup, sports and so much more. The blog is updated regularly to make sure you have all the latest and greatest information on the topics that matter most to you.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button