JavaScript for verify presence of
Windows Media ActiveX
Hi all,
The following
articles are to provide some basics ideas. By using it you can test for the presence of
the Windows Media ActiveX control
with the following JavaScript:
01 var player;
02 var plugin;
03 var hasActiveX=false;
04 try {
05 if
(window.ActiveXObject)
06 {
07 hasActiveX = true;
08 player = new
ActiveXObject ("WMPlayer.OCX.7");
09 }
10 else if
(window.GeckoActiveXObject)
11 {
12 hasActiveX = true;
13 player = new
GeckoActiveXObject ("WMPlayer.OCX.7");
14 }
15 } catch (oError) { }
16 try {
17 if (navigator.mimeTypes)
18 {
19 plugin =
navigator.mimeTypes ['application/x-mplayer2'].enabledPlugin;
20 }
21 }catch (oError) {}
22 var message = "Your browser "+ (hasActiveX ?
"does" : " does not") +" support ActiveX. \n";
23 message += "The WMP
ActiveX control is"+ (player ? "" : " not") +"
installed. \n";
24 message += "The WMP Plugin "+ (plugin?”is" :
"is not") +" installed. \n";
25 alert(message);