topical media & game development

talk show tell print

professional-javascript-18-CrossBrowserFlashDetectExample.htm / htm



  <html>
      <head>
          <title>Cross-Browser Flash Detect Example</title>
      </head>
      <body>
          <script type="text/javascript">
          
              function detectFlash() {
                  if (navigator.mimeTypes.length > 0) {
                      return navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin != null;
                  } else if (window.ActiveXObject) {
                      try {
                          new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
                          return true;
                      } catch (oError) {
                          return false;
                      }
                  } else {
                      //no way to detect!
                      return false;
                  }
              }
              
              if (detectFlash()){
                  alert("You have Flash installed.");
              } else {
                  alert("You do not have Flash installed.");
              }
  
          </script>
      </body>
  </html>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.