PDA

View Full Version : ActiveX, Javascript, & ShockwaveFlash.2 woes


mseeley
09-13-2004, 08:29 PM
hi all. below is an all javascript flash detector inspired by a reader submission @ quirksmode. the strangeness is that i cannot instantiate a ShockwaveFlash.ShockwaveFlash.2 ActiveXOobject. now i did read that version 2 of the plugin had a different name in navigator (...2.0) but appending a .0 in IE didn't do any good.

the html below includes a hack that gets around the v2 bug. although i don't think i'd ever need to deliver content to pre v6 players i don't like using this hack.

any ideas?


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>getFlashPlayerVersion</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript">
function getFlashPlayerVersion()
{
var version = 0;
if(document.all){
var i=0, ax;
while(true){
try{
ax = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.' + ++i);
}
catch(e){
if(i == 2) continue;
version = --i;
break;
}
}
} else {
var pluginDesc = (navigator.mimeTypes && navigator.mimeTypes['application/x-shockwave-flash']) ? navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin.description : false;
if (pluginDesc) version = parseInt(pluginDesc.substring(pluginDesc.indexOf('.')-1));
}

return version ? version : false;
};
var version = getFlashPlayerVersion();
alert(version);
</script>
</head>
<body />
</html>

mseeley
09-14-2004, 07:40 PM
anyone remotely interested in checking this out?

mseeley
09-15-2004, 02:55 PM
last bump then i'll go try we're here...