Reputation: 2290
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 ?
Upvotes: 3
Views: 7915
Reputation: 614
Follow these steps:
Note: These steps are compatible 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
});
Upvotes: 0
Reputation: 607
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.
Upvotes: 2
Reputation: 1263
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.
Upvotes: 3