ES6
Created
November 25, 2020 23:01
-
-
Save luisenriquecorona/2396f5eaf4716757c683368eb62418e9 to your computer and use it in GitHub Desktop.
Plug-in Detection.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// plugin detection - doesn't work in Internet Explorer 10 or below | |
let hasPlugin = function(name) { | |
name = name.toLowerCase(); | |
for (let plugin of window.navigator.plugins){ | |
if (plugin.name.toLowerCase().indexOf(name) > -1){ | |
return true; | |
} | |
} | |
return false; | |
} | |
// detect flash | |
console.log(hasPlugin("Flash")); | |
// detect quicktime | |
console.log(hasPlugin("QuickTime")); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment