Subversion Repositories Sites.tela-botanica.org

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 david 1
var agt=navigator.userAgent.toLowerCase();
2
var ie = (agt.indexOf("msie") != -1);
3
var ns = (navigator.appName.indexOf("Netscape") != -1);
4
var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
5
var mac = (agt.indexOf("mac")!=-1);
6
 
7
function detectIE(ClassID,name) {
8
	result = false;
9
	document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))</SCRIPT>\n');
10
	if (result) return name+',';
11
	else return '';
12
}
13
 
14
function detectNS(ClassID,name) {
15
	n = "";
16
	if (nse.indexOf(ClassID) != -1)
17
		if (navigator.mimeTypes[ClassID].enabledPlugin != null)
18
			n = name+",";
19
	return n;
20
}
21
 
22
if (ie && win) {
23
	pluginlist = detectIE("Adobe.SVGCtl","SVG Viewer")
24
	+ detectIE("SWCtl.SWCtl.1","Shockwave Director")
25
	+ detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash")
26
	+ detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer")
27
	+ detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime")
28
	+ detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player")
29
	+ detectIE("PDF.PdfCtrl.5","Acrobat Reader"); }
30
 
31
if (ns || !win) {
32
	nse = "";
33
	for (var i=0; i<navigator.mimeTypes.length; i++)
34
		nse += navigator.mimeTypes[i].type.toLowerCase();
35
 
36
	pluginlist = detectNS("image/svg-xml","SVG Viewer")
37
		+ detectNS("application/x-director","Shockwave Director")
38
		+ detectNS("application/x-shockwave-flash","Shockwave Flash")
39
		+ detectNS("audio/x-pn-realaudio-plugin","RealPlayer")
40
		+ detectNS("video/quicktime","QuickTime")
41
		+ detectNS("application/x-mplayer2","Windows Media Player")
42
		+ detectNS("application/pdf","Acrobat Reader");
43
 
44
}
45
 
46
 
47
 
48
 
49
pluginlist += navigator.javaEnabled() ? "Java," : "";
50
if (pluginlist.length > 0) pluginlist = pluginlist.substring(0,pluginlist.length-1);
51
 
52
 
53
//SAMPLE USAGE- detect "Flash"
54
//if (pluginlist.indexOf("SVG")!=-1)
55
	//alert(pluginlist) ;