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.
Approach:
- 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.
Example 1: This example checks the flash player is installed or not.
<!DOCTYPE HTML> <html> <head> <title> How to detect flash is installed or not using JavaScript ? </title> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksForGeeks </h1> <p id="GFG_UP" style= "font-size: 19px;font-weight: bold;"> </p> <button onclick="GFG_Fun()"> click here </button> <p id="GFG_DOWN" style= "color: green; font-size: 24px; font-weight: bold;"> </p> <script> var el_up = document.getElementById("GFG_UP"); var el_down = document.getElementById("GFG_DOWN"); el_up.innerHTML = "Click on the button to check"+ " whether Adobe Flash is installed or not"; var Flash = false; function GFG_Fun() { try { Flash = Boolean(new ActiveXObject('ShockwaveFlash.ShockwaveFlash')); } catch (exception) { Flash = ('undefined' != typeof navigator.mimeTypes[ 'application/x-shockwave-flash']); } el_down.innerHTML = Flash; } </script> </body> </html> |
chevron_right
filter_none
Output:
-
Before clicking on the button:
-
After clicking on the button:
Example 2: This example checks the flash player is installed or not.
<!DOCTYPE HTML> <html> <head> <title> How to detect flash is installed or not using JavaScript ? </title> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksForGeeks </h1> <p id="GFG_UP" style= "font-size: 19px;font-weight: bold;"> </p> <button onclick="GFG_Fun()"> click here </button> <p id="GFG_DOWN" style= "color: green; font-size: 24px; font-weight: bold;"> </p> <script> var el_up = document.getElementById("GFG_UP"); var el_down = document.getElementById("GFG_DOWN"); el_up.innerHTML = "Click on the button to check whether" + " Adobe Flash is installed or not"; var Flash = false; function GFG_Fun() { try { var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); if (fo) { hasFlash = true; } } catch (e) { if (navigator.mimeTypes && navigator.mimeTypes[ 'application/x-shockwave-flash'] != undefined && navigator.mimeTypes['application/x-shockwave-flash' ].enabledPlugin) { hasFlash = true; } } el_down.innerHTML = Flash; } </script> </body> </html> |
chevron_right
filter_none
Output:
-
Before clicking on the button:
-
After clicking on the button:
Recommended Posts:
- Detect a device is iOS or not using JavaScript
- How to detect browser or tab closing in JavaScript ?
- How to detect touch screen device using JavaScript?
- Detect the Operating System of User using JavaScript
- How to detect operating system on the client machine using JavaScript ?
- How to detect the device is an Android device using JavaScript ?
- How to detect escape key press using jQuery?
- How to detect a mobile device in jQuery?
- How to detect when user scrolls to the bottom of a div ?
- How to detect the user's device using jQuery ?
- How to detect if a function is called as constructor?
- JQuery | Detect a textbox content is changed or not
- Introduction to JavaScript Course | Learn how to Build a task tracker using JavaScript
- How to compare two JavaScript array objects using jQuery/JavaScript ?
- JavaScript Course | Understanding Code Structure in JavaScript
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



