Detect Flash using jQuery

In one of my project, I needs to detect flash driver. I searched lot but not found small and staright forward script. Finally, I found jqPlugin from jquery plugin directory.It is very helpful to check various AddOns of browsers. Here is the list of other browser plugin which we can test using this plugin.
  • Flash
  • Silverlight
  • PDF(checks if pdf mimetype is supported not limited to one PDF application)
  • Java
  • Quicktime
  • Windows Media Player
  • Shockwave
  • Realplayer
In below script, you will get code to detect flash player.

 <script type="text/javascript" src="jquery.js"></script>  
 <script type="text/javascript" src="jquery.jqplugin.1.0.2.min.js"></script>  
 <script type="text/javascript">  
 $(document).ready(function() {  
 $("#withflash").hide();  
 $("#noflash").hide();  
 if ($.browser.flash == true)  
   $("#withflash").show ();  
 else  
   $("#noflash").show ();  
  });  
 </script>  
 <div id="withflash">Flash Supported</div>  
 <div id="noflash">Flash Not Supported</div>  



Example
Flash Supported
Flash Not Supported


Comments

  1. Can anyone have solution for other html page not for html 5?

    ReplyDelete
  2. the plug-in does not work in IE.

    ReplyDelete
    Replies
    1. This worked for me in IE. It does look for ActiveX

      Delete
  3. totally worked for delivering alternate content on iPad and iPhone. thank you! :)

    ReplyDelete
  4. Thanks for the sample code and link to the script. Works as described.

    I'm substituting *.swf with HTML5 conversion (via Google Swiffy).

    ReplyDelete
  5. This works for me in Chrome Browser, but looks like it does not work on mobile Android devices. (At least on my galaxy y (android 2.6) the plugin is not able to test for flash support.

    Any solutions to this?

    ReplyDelete
  6. Using IE the script has to be run on a server for it to work. Running on a local machine (not using a local test server) then it probably won't work, but this is as expected (IE security) but you can probably change the security settings for testing without a local test server (such as WAMP).

    ReplyDelete
  7. The plug-in does not work in iPad & iPhone.

    ReplyDelete
  8. i want to make enable flash player in browsers while loading webpage using jquery or javascript

    ReplyDelete

Post a Comment