Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

[JavaScript] Check for Flash


No replies to this topic

#1 Guest_Mr. Vulcano_*

  • Guests

Posted 18 January 2005 - 09:48 AM

This script i have modified. With this script you can check if Flash is installed.
<script language="javascript" type="text/javascript">

   <!--



   var flashinstalled = 0;

   var flashversion = 0;

   MSDetect = "false";

   if (navigator.plugins && navigator.plugins.length)

   {

      x = navigator.plugins["Shockwave Flash"];

      if (x)

      {

         flashinstalled = 2;

         if (x.description)

         {

            y = x.description;

            flashversion = y.charAt(y.indexOf('.')-1);

         }

      }

      else

         flashinstalled = 1;

      if (navigator.plugins["Shockwave Flash 2.0"])

      {

         flashinstalled = 2;

         flashversion = 2;

      }

   }

   else if (navigator.mimeTypes && navigator.mimeTypes.length)

   {

      x = navigator.mimeTypes['application/x-shockwave-flash'];

      if (x && x.enabledPlugin)

         flashinstalled = 2;

      else

         flashinstalled = 1;

   }

   else

      MSDetect = "true";





   // -->

   </script>



   <script language="vbscript" type="text/vbscript">



   on error resume next



   If MSDetect = "true" Then

      For i = 2 to 6

         If Not(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then



         Else

            flashinstalled = 2

            flashversion = i

         End If

      Next

      If flashinstalled = 0 Then

         flashinstalled = 1

      End If

   End If



   </script>



<script language="javascript" type="text/javascript">

<!--

if (flashinstalled == 2)

{

   if (flashversion)

      document.write("You have Flash version " + flashversion + " installed.");

   else

      document.write("You have Flash installed, but I can't detect the version.");

}

else if (flashinstalled == 1) document.write("You don't have Flash installed.");

else document.write("I can't find out if you have Flash installed.");

// -->

</script>





Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users