Modern or Non-deprecated way to detect flash player with js/jquery?

前端 未结 2 761
夕颜
夕颜 2020-12-15 13:53

First of all, sorry for ressurrecting this question here. I\'ve been trying for two days how to reach this job using javascript/jquery and i think i\'ve read all stack overf

2条回答
  •  半阙折子戏
    2020-12-15 14:08

    You can get an array which contains all installed plugins of a browser like this:

    var plugins = navigator.plugins;
    

    Then you can then check if the array contains the flash plugin.

    From https://developer.mozilla.org/de/docs/Web/API/NavigatorPlugins/plugins:

    function getFlashVersion() {
       var flash = navigator.plugins.namedItem('Shockwave Flash');
       if (typeof flash != 'object') {
          // flash is not present
          return undefined;
       }
       if(flash.version){ 
         return flash.version;
       } else {
         //No version property (e.g. in Chrome)
         return flash.description.replace(/Shockwave Flash /,"");
      }
    }
    

提交回复
热议问题