[ Index ] |
|
Code source de SPIP Agora 1.4 |
1 //This script detects the following: 2 //Flash 3 //Windows Media Player 4 //Java 5 //Shockwave 6 //RealPlayer 7 //QuickTime 8 //Acrobat Reader 9 //SVG Viewer 10 11 12 var agt=navigator.userAgent.toLowerCase(); 13 var ie = (agt.indexOf("msie") != -1); 14 var ns = (navigator.appName.indexOf("Netscape") != -1); 15 var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1)); 16 var mac = (agt.indexOf("mac")!=-1); 17 18 if (ie && win) { pluginlist = detectIE("Adobe.SVGCtl","SVG Viewer") + detectIE("SWCtl.SWCtl.1","Shockwave Director") + detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash") + detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer") + detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime") + detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player") + detectIE("PDF.PdfCtrl.5","Acrobat Reader"); } 19 if (ns || !win) { 20 nse = ""; for (var i=0;i<navigator.mimeTypes.length;i++) nse += navigator.mimeTypes[i].type.toLowerCase(); 21 pluginlist = detectNS("image/svg-xml","SVG Viewer") + detectNS("application/x-director","Shockwave Director") + detectNS("application/x-shockwave-flash","Shockwave Flash") + detectNS("audio/x-pn-realaudio-plugin","RealPlayer") + detectNS("video/quicktime","QuickTime") + detectNS("application/x-mplayer2","Windows Media Player") + detectNS("application/pdf","Acrobat Reader"); 22 } 23 24 function detectIE(ClassID,name) { result = false; document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))</SCRIPT>\n'); if (result) return name+','; else return ''; } 25 function detectNS(ClassID,name) { n = ""; if (nse.indexOf(ClassID) != -1) if (navigator.mimeTypes[ClassID].enabledPlugin != null) n = name+","; return n; } 26 27 pluginlist += navigator.javaEnabled() ? "Java," : ""; 28 if (pluginlist.length > 0) pluginlist = pluginlist.substring(0,pluginlist.length-1); 29 30 //SAMPLE USAGE- detect "Flash" 31 //if (pluginlist.indexOf("Flash")!=-1) 32 //document.write("You have flash installed")
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |