|
for August 19, 1996: Checking for Plugins and File Types
Note: This plugins tip has been improved to help you detect all plugins. Netscape 3.0 allows you to detect which plugins and file types are incorporated into a browser. This week's tip will show you how to utilitize those functions. This Script displays a list of all of the plugins that are installed on a browser, their file names, and their descriptions: This script is not very useful in and of it itself, but you can use it as a tool to detect specific plugins. Using a simnple two line function, you can easily detect any specific plugin. For instance, I know that you installed on your browser. I also know that you Now, to detect plugins easily and efficiently, just use this function:
function plugdetect(plugName)
{
if (navigator.plugins[plugName]) return true;
else return false;
}
Just use a simple if statement with the name of the plugin to put the function to work:
if (plugdetect("LiveAudio") == true)
document.write("have the LiveAudio plugin");
else document.write("do not have the LiveAudio plugin");
In place of "have the LiveAudio plugin" you could put an EMBED tag and the display a LiveAudio control. Otherwise you could have the script ask you to get the plugin.
As you can see, this is a simple but effective JavaScript function. I hope you find more creative ways than I have to use this tip. Untill next time... I'll see you on JavaScript Tip of the Week. |
| ||||||||||||||||||||