Get a list of installed extensions with javascript - Stack Overflow

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

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 ?

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 ?

Share Improve this question asked Nov 7, 2013 at 8:17 lior rlior r 2,3007 gold badges44 silver badges82 bronze badges 6
  • Unless the browser has provided a specific API to access this, no. Where are you running this JavaScript? – Qantas 94 Heavy Commented Nov 7, 2013 at 8:20
  • well is there a specific API for that on chrome/firefox and ie ? – lior r Commented Nov 7, 2013 at 12:23
  • What is this for though? Is this a webpage, is this an extension itself, userscript, what? – Qantas 94 Heavy Commented Nov 7, 2013 at 12:30
  • it is a webpage that suppose to list the current installed extensions – lior r Commented Nov 7, 2013 at 12:40
  • 2 In that case unfortunately I don't think that's possible. – Qantas 94 Heavy Commented Nov 7, 2013 at 12:41
 |  Show 1 more ment

3 Answers 3

Reset to default 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.

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

Follow these steps:

Note: These steps are patible 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
    });
    

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744222456a4563850.html

相关推荐

  • Get a list of installed extensions with javascript - Stack Overflow

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

    8天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信