JavaScript Tip of the Week for August 19, 1996: Checking for Plugins and File Types | Source Code | WebReference

JavaScript Tip of the Week for August 19, 1996: Checking for Plugins and File Types | Source Code

JavaScript Tip of the Weekfor August 19, 1996: Source Code: Checking for Plugins and File Types


This function will detect any plugin:
/* This code is Copyright (c) 1996 Nick Heinle and Athenia Associates, 
 * all rights reserved. In order to receive the right to license this 
 * code for use on your site the original code must be copied from the
 * Web site webreference.com/javascript/. License is granted to user to 
 * reuse this code on their own Web site if and only if this entire copyright
 * notice is included. Code written by Nick Heinle of webreference.com.
 */
function plugdetect(plugName) 
{
         if (navigator.plugins[plugName]) return true;
         else return false;
}
Use an if statement similiar to this one combined with the above function to detect plugins, putting the plugin name in place of "LiveAudio":
        if (plugdetect("LiveAudio") == true)
        document.write("have the LiveAudio plugin");
        else document.write("do not have the LiveAudio plugin");