Cross Browser Flash Detection in Javascript


Hits: 6829  

Option 1:

<script type="text/javascript">

      $(document).ready(function(){

      if (navigator.mimeTypes ["application/x-shockwave-flash"] == undefined)
      {
        alert("Flash is not insalled on your Web browser.");
      }
      else
      {
        alert("Flash is insalled on your Web browser.");
      }

      });
</script>

 

Option 2: JavaScript Flash Detection Library (Flash Detect)

<script src="flash_detect.js"></script>
<script type="text/javascript"> 
    if(!FlashDetect.installed){
        alert("Flash is not insalled on your Web browser.");         
    }else{
        alert("Flash is insalled on your Web browser.");
    }
</script>

 

Option 3: SWFObject is an easy-to-use and standards-friendly method to embed Flash content, which utilizes one small JavaScript file

SWFObject
SWFObject

To detect whether a browser has the flash plugin, first load the SWFObject library, then:

<script>
    if (swfobject.getFlashPlayerVersion().major) {
        alert("Flash is insalled on your Web browser.");
    } else {
        alert("Flash is not insalled on your Web browser.");
    };
</script>

Other SWFObject functions:
swfobject.getFlashPlayerVersion().major is the major version
swfobject.getFlashPlayerVersion().minor is the point release
swfobject.getFlashPlayerVersion().release is the build number

 

Option 4: jQuery SWFObject

if (!$.flash.hasVersion('9')) {
 //has Flash
 alert("Flash is insalled on your Web browser.");
}
else {
 //no_flash
 alert("Flash is not insalled on your Web browser."); 
}

Published by

Sandeep Verma

I’m an Entrepreneur. I’m proud to work as Blogger, LAMP Programmer, Linux Admin, Web Consultant, Cloud Manager, Apps Developer, Searcher. Concentrate > Observe > Imagine > Launch