Skip to content

Instantly share code, notes, and snippets.

@eedeebee
Forked from greatghoul/manifest.json
Created March 29, 2022 20:06
Show Gist options
  • Save eedeebee/0dc4e00859a7ad5b70159c1948a68078 to your computer and use it in GitHub Desktop.
Save eedeebee/0dc4e00859a7ad5b70159c1948a68078 to your computer and use it in GitHub Desktop.
Chrome Extension Sample - detect if an extension is installed.
{
"name": "Detect if an extension installed",
"description": "Detect if an extension installed",
"version": "0.1",
"manifest_version": 2,
"permissions": [
"management"
],
"browser_action": {
"default_popup": "popup.html"
}
}
<body style="width: 400px; height: 150px;">
<div id="output"></div>
<script type="text/javascript" src="popup.js"></script>
</body>
var extensionIds = [
["Session Buddy", "edacconmaakjimmfgnblocblbcdcpbko"],
["Readability", "oknpjjbmpnndlpmnhmekjpocelpnlfdi"]
];
extensionIds.forEach(function(extension) {
var output = document.getElementById('output');
chrome.management.get(extension[1], function(result) {
var extensionElement = document.createElement('div');
console.log(result);
if (result) {
extensionElement.innerHTML = ""
+ "<h3>" + result.name + " (" + result.id + ")</h3>"
+ "<p>" + result.description + "</p>";
} else {
extensionElement.innerHTML = ""
+ "<h3>" + extension[0] + " (" + extension[1] + ")</h3>"
+ "<p style=\"color: red;\">Not installed</p>";
}
output.appendChild(extensionElement);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment