Skip to content

Instantly share code, notes, and snippets.

@josemmo
Created March 28, 2018 08:22
Show Gist options
  • Save josemmo/7b31778adafd2b49285d85d2bd54f90c to your computer and use it in GitHub Desktop.
Save josemmo/7b31778adafd2b49285d85d2bd54f90c to your computer and use it in GitHub Desktop.
// Extensiones instaladas en Google Chrome
fp_sources.extensions = {};
var exposed_resources = [
['chrome-extension://.../f1.png', 'AdBlock'],
['chrome-extension://.../f2.png', 'Ghostery'],
['chrome-extension://.../f3.png', 'WOT']
];
var checkChromeExtension = function(i) {
if (i < exposed_resources.length) {
var ex = exposed_resources[i];
var dummy = new Image();
dummy.src = ex[0];
dummy.onload = function() {
fp_sources.extensions[ex[1]] = true;
checkChromeExtension(i+1);
};
dummy.onerror = function() {
fp_sources.extensions[ex[1]] = false;
checkChromeExtension(i+1);
};
} else {
// Hemos terminado la detección,
// aquí continuaría nuestro script
}
};
// Iniciamos la ejecución asíncrona del script
checkChromeExtension(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment