Get a list of installed extensions with javascript
Asked Answered
A

3

3

Im trying to figure out if it is possible to get a list of all installed browser extensions using javascript

I understand it is possible on

chrom using - chrome.extension reference firefox - using Application.extensions.all

But is it possible on IE and Safari ?

Archpriest answered 7/11, 2013 at 8:17 Comment(6)
Unless the browser has provided a specific API to access this, no. Where are you running this JavaScript?Aba
well is there a specific API for that on chrome/firefox and ie ?Archpriest
What is this for though? Is this a webpage, is this an extension itself, userscript, what?Aba
it is a webpage that suppose to list the current installed extensionsArchpriest
In that case unfortunately I don't think that's possible.Aba
yeah i thought so :-) thxArchpriest
H
3

You can only do that from the Chrome Context (Firefox) or Background Script (Chrome). It is not possible to get the list of extensions from a webpage.

Halbert answered 7/11, 2013 at 13:59 Comment(0)
E
2

It's not possible to get a list of all the installed extension with "Chrome tabs".enter image description here you only able to get extension list view extension tabs.

Energid answered 12/7, 2019 at 15:2 Comment(0)
A
0

Follow these steps:

Note: These steps are compatible with manifest V3 and V2

  1. Add managment permission to manifest file

    ...
    "permissions": [
       "management"
    ]
    ...
    
  2. Call to get all installed extensions list in the background.js file

    chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
        const result = detectMessageType(request, sender);
    
        // Check if result exists
        if (result) {
            result.then(response => {
                return sendResponse(response);
            });
        }
    });
    
    function detectMessageType(request, sender) {
    
        // Check background request type
        if (request && request.type) {
            switch (request.type) {
                case 'get_all_installed_extensions': {
                    return getAllInstalledExt(request.options, sender);
                }
            }
        }
    }
    
    async function getAllInstalledExt() {
        const gettingAll = chrome.management.getAll();
        return await gettingAll.then(infoArray => {
            return infoArray.filter(item => item.type === "extension").map(item => item.name);
        });
    }
    
  3. Then in your main js file of your extension app, write this to get the list of installed extensions

    chrome.runtime.sendMessage({type: 'get_all_installed_extensions'}, response => {
        console.log(response); // print the list of installed extensions
    });
    
Amphicoelous answered 8/6, 2022 at 10:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.