Detecting Browser Plug-Ins

Browser plug-ins, such as RealPlayer, Shockwave/Flash, Quicktime, and others, can add multimedia functionality to a Web site and help attract and retain visitors. If a particular visitor doesn’t have a particular plug-in, however, the savvy Web designer will want to provide a different experience–an animated GIF, a Netscape sound, or something along those lines. It’s possible to detect the presence or absence of any known plug-in with a JavaScript function, and then deliver content appropriately:

     function detect_plugin(name)  {             if (navigator.plugins[name]) return true;             else return false;         }

Just use a simple if statement with the name of the plug-in to put the function to work:

          if (detect_plugin("Beatnik") == true)              document.write("Beatnik code goes here");         else document.write("No Beatnik - do something else");
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: