A modern or not obsolete way to detect a flash player using js / jquery?

First of all, sorry for repeating this question. I tried for two days how to achieve this work using javascript / jquery, and I think I read all the other blog posts about it, so please do not mark it as duplicated, because I cannot use outdated ones scenarios from 2012 to 2017.

I have one page that redirects to a third-party e-learning platform where some content needs a flash to work. Many users do not care about what software is installed on their machines (what's new, huh), so I need to find it and show a typical message "please install / update the flash player by clicking here," but I can’t find it " The modern "script / way to do this, anywhere, is simplified if possible.

All scripts I tried are outdated or return false in all browsers, even if I have the latest version of flash memory installed and is active.

Anny help will be appreciated (except for links to old posts or scripts that are not currently working, obviously).

Thanks a lot!

+5
source share
2 answers

There is an easy way to check for Flash, since all plugins are installed and enabled are listed in navigator.plugins;

Please note that if the plugin is installed but not enabled , it will not be detected in the navigator.plugins array. There is NO way to detect this with Javascript (this Question , which confirms the same).

Having said that, use the following function isFlashEnabled(); To detect Flash:

 <html> <script> if(isFlashEnabled()) { document.write('Flash is installed (but may need to be enabled)'); } else { document.write('Flash is either not installed or disabled'); } function isFlashEnabled() { var flash = navigator.plugins.namedItem('Shockwave Flash'); if (!flash) { return 0; } else { return 1; } } </script> <body> <embed src="https://www.w3schools.com/tags/helloworld.swf"> </body> </html> 
+3
source

You can get an array that contains all installed browser plugins as follows:

 var plugins = navigator.plugins; 

Then you can 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 (eg in Chrome) return flash.description.replace(/Shockwave Flash /,""); } } 
0
source

Source: https://habr.com/ru/post/1265315/


All Articles