After some heavy googling I came up with this; however the IE part does not work I'm afraid, in my IE it always returns false. I have been trying quite everything, but I don't know that much about VBScript, which is necessary to check for the Flash plugin in IE.
Anyway; here goes
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript">
function checkForFlash() {
var browser = navigator.appName;
var flashVersion;
var hasFlash = navigator.mimeTypes["application/x-shockwave-flash"];
if(hasFlash) {
document.getElementById('divInfo').innerHTML = "You have the Flash Player plugin.";
}
else if(browser == "Microsoft Internet Explorer") {
hasFlash = false;
MSDetect = "true";
document.write('<script type="text/vbscript"\> \n');
document.write('on error resume next \n');
document.write('If MSDetect = "true" Then \n');
document.write(' For i = 2 to 10 \n');
document.write(' If (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then \n');
document.write(' hasFlash = true \n');
document.write(' flashVersion = i \n');
document.write(' End If \n ');
document.write(' Next \n');
document.write('End If \n');
document.write('</script\> \n');
alert(hasFlash);
}
}
</script>
</head>
<body onLoad="javascript:checkForFlash();">
<div id="divInfo" style="width: 300px; height: 200px; background-color: #bbbbbb;">
</div>
</body>
</html>
I guess it has something to do with the hasFlash variable being set to true for the right version, but when the for loop loops another time it just resets it back to false. However, I can't solve this myself, I might google somewhat later but now I have to study for my exams today ^^
Last edited by brechtjah; Dec 9th, 2008 at 5:52 am.
Reputation Points: 26
Solved Threads: 9
Junior Poster in Training
Offline 92 posts
since Nov 2008