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
3 Answers
Reset to default 3You 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
Add managment permission to manifest file
... "permissions": [ "management" ] ...
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); }); }
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
评论列表(0条)