[thelist] Flash detection for IE5
Charlie Llewellin
sallyevans at eden.com
Fri Dec 15 09:38:38 CST 2000
Here is my version of the methods I have found out there, offered in the
hope that it might be useful..
tested on NN 3.04, 4.08, Communicator 4.72(mac only) , NN6, IE 5(mac) IE
5.5(windows)..
For Flash 4 up;
<script language="JavaScript" type="text/javascript">
<!--
// FLASH DETECTION - must be at least version 4
var flash4Installed = false; // boolean. true if flash 4 is installed
var flash5Installed = false; // boolean. true if flash 5 is installed
var flashmode = 0;
var maxVersion = 5; // highest version available
//-->
</script>
<script language="JavaScript1.1" type="text/javascript">
<!--
// VBScript detection for IE Windows
if (bname == "ie" && os == "windows") {
document.write('<scr' + 'ipt language="VBScript">\n');
document.write('on error resume next\n');
document.write('flash4Installed =
(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4")))\n');
document.write('flash5Installed =
(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5")))\n');
document.write('<\/scr' + 'ipt>\n');
}
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
function flashDetect() {
for (var i = 4; i <= maxVersion; i++) {
if (eval("flash" + i + "Installed") == true) flashmode = 1;
}
if (navigator.plugins && navigator.plugins.length > 0) {
if (navigator.plugins["Shockwave Flash"]) {
var plugin_version = 0;
var words = navigator.plugins["Shockwave
Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i) {
if (isNaN(parseInt(words[i]))) {
continue;
}
plugin_version = words[i];
}
if (plugin_version >= 4) {
var plugin = navigator.plugins["Shockwave Flash"];
var numTypes = plugin.length;
for (var j = 0; j < numTypes; j++) {
mimetype = plugin[j];
if (mimetype){
if (mimetype.enabledPlugin &&
(mimetype.suffixes.indexOf("swf") != -1)) {
flashmode = 1;
}
// IE 3 + 4 on Mac do not have a plug-ins array..
sorry
if
(navigator.mimeTypes["application/x-shockwave-flash"] == null) {
flashmode = 0;
}
}
}
}
}
}
}
flashDetect();
//-->
</script>
charlie
More information about the thelist
mailing list