Detecting NPAPI support in Chrome using javascript Detecting NPAPI support in Chrome using javascript google-chrome google-chrome

Detecting NPAPI support in Chrome using javascript


Had an issue created by chrome 42's disabling of NPAPI. What was done was something in the lines of this: (similar to )

function isJavaAvailable() {  var javaRegex = /(Java)(\(TM\)| Deployment)/,      plugins = navigator.plugins;  if (navigator && plugins) {    for (plugin in plugins){      if(plugins.hasOwnProperty(plugin) &&         javaRegex.exec(plugins[plugin].name)) {        return true;      }    }  }  return false;}var chromeVersion = window.navigator.userAgent.match(/Chrome\/(\d+)\./);if (chromeVersion && chromeVersion[1]) {  if (parseInt(chromeVersion[1], 10) >= 42 && !isJavaAvailable()) {    // do chrome-no-java-related task    console.log('Java not available');  }}