Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 overflow and other blogs posts about that, so please, don't mark it as duplicated because I can't use out-dated scripts from 2012 now in 2017.

I've a single page that redirects to a third party e-learning platform where some content needs flash to work. Many users don't care about which software is installed on their machines (what a new, huh) so i need to detect it and show the tipical message "please install/update flash player clicking here", but i cannot find a "modern" script/way to do this, in any place, simplified, if possible.

All scripts i've tried are deprecated or returns false in all browsers, even i've newest version of flash installed and active.

Anny help will be appreciated (except links to older posts or scripts that don't work nowadays, obviously).

Thanks a lot!

like image 760
JoelBonetR Avatar asked Mar 10 '17 21:03

JoelBonetR


People also ask

How to detect Flash is installed or not using JavaScript?

How to detect flash is installed or not using JavaScript ? The task is to detect whether the user has installed Adobe Flash player or not with the help of JavaScript. we’re going to discuss 2 techniques. Create a ShockwaveFlash.ShockwaveFlash object. If the instance’s value is true, Flash is installed.

How to detect whether the user has installed Adobe Flash Player?

The task is to detect whether the user has installed Adobe Flash player or not with the help of JavaScript. we’re going to discuss 2 techniques. Create a ShockwaveFlash.ShockwaveFlash object. If the instance’s value is true, Flash is installed. If any error occurred, Use navigator.mimetypes property to know whether the flash is installed.

What is the Yahoo flashdetect namespace?

The YAHOO.util.FlashDetect namespace is used to contain the library within the YAHOO global Object. For more details pertaining to the YUI namespace implementation and dependencies please refer to the YAHOO.namespace documentation.


1 Answers

There is a simple way to check for Flash since all the installed and enabled plugins will be listed in navigator.plugins;

Note that if a plugin is installed, but not enabled, it will not be detected in the navigator.plugins array. There is NO way to detect this using 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>
like image 60
Niket Pathak Avatar answered Oct 16 '22 10:10

Niket Pathak