// a script based detector for flash files function traceObj(obj){ var i; for(i in obj){ document.write(i + ":" + obj[i] + "
\n"); } } // broswer detect var ie = (navigator.appVersion.indexOf("MSIE") != -1) ? 1 : 0; var win = (navigator.appVersion.indexOf("Windows") != -1) ? 1 : 0; var mac = (navigator.appVersion.indexOf("Macintosh") != -1) ? 1 : 0; function getFlashVersion(){ // this object will contain relevant info and be returned // at the end of the function var player = { 'description':null, 'version':null, 'majVersion':null, 'minVersion':null } // if this works we're laughing if(navigator.plugins['Shockwave Flash']){ // d will equal something like: Shockwave Flash 6.0 r29 var d = player.description = navigator.plugins['Shockwave Flash'].description; // get a major and minor from that... '[ r]+' is for mozilla, ' r' doesn't work (?) var rexp = /([\d\.]+)[ r]+([\d\.]+)/; var result = rexp.exec(d); if(result){ player.version = result[0]; player.majVersion = result[1]; player.minVersion = result[2]; } } else if(navigator.userAgent.indexOf("WebTV") != -1){ // don't like this because it's static, hopefully the plugins array will work in future versions player.majVersion = 3; player.description = "WebTV"; } else if(ie && win){ // why doesn't win/ie support plugin detection? sigh. use vbscript // put the maxVersion here var maxVersion = 7; // var a = ''; a+=' \n'; a+='i=4 \n'; a+='Do While (i < '+ maxVersion + ') \n'; a+=' If(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then \n'; a+=' VB_version = i \n'; a+=' i=i+1 \n'; a+=' End If \n'; a+='Loop \n'; a+=' \n'; document.write(a); player.description = "win/ie"; player.majVersion = player.version = VB_version; } return (player.description) ? player : false; }