Skip to content

Instantly share code, notes, and snippets.

View mattccrampton's full-sized avatar
🎯
Focusing

Matt Crampton mattccrampton

🎯
Focusing
View GitHub Profile
@kentbrew
kentbrew / WebExtensionCheck.js
Last active August 6, 2018 14:37
How to tell if visitors to your site are running a WebExtensions-compatible extension
// If we know the extension's ID and a path to one of its web-accessible resources, we can quietly check for presence.
(function (w, a) {
var checkExt = function (callback) {
var hazExt = false;
var img = new Image();
img.onload = function () {
hazExt = true;
};
// need to know the right protocol for Firefox and Edge extensions