Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Web
Expertise: Intermediate
Apr 21, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

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");
Steve Renaker
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date