May 10, 2001 - Checking the Plug-ins for Mac and Win Navigator
May 10, 2001 Checking the Plug-in Installation Tips: May 2001
Yehuda Shiran, Ph.D.
|
One of these tiny details is checking that the Flash plug-in is installed in Mac or Windows Navigator. The following function, Flash_checkForPlugIn()
, does exactly that. It checks that the mimeTypes
object exists, that one of the mime types is flash
, and that its relevant plug-in is enabled. The function also extracts the plug-in version, and checks that it is higher than the default minimum player version. The default minimum player version is set as a global variable before calling Flash_checkForPlugIn()
. Here is the function in full, remember that it must be preceded by the global variable assignment of minPlayer
:
function Flash_checkForPlugIn() {
var plugin = (navigator.mimeTypes &&
navigator.mimeTypes["application/x-shockwave-flash"]) ?
navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if (plugin) {
var pluginversion =
parseInt(plugin.description.substring(plugin.description.indexOf(".")-1))
if(pluginversion >= minPlayer) {return true;}
}
return false;
}