Yep, you got it, that's almost all you need. One thing I noticed is that this was written around the time of Flash 6, so you need to change it in one spot:
Code:
If MSDetect = "true" Then
For i = 2 to 12
If Not(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then
Once that runs on your page you get two variables:
After the detect, the variable
flashinstalled can have three values:
- 2: Flash installed
- 1: Flash not installed
- 0: Unknown if Flash is installed
The variable
flashversion contains the version of Flash. If the version is unknown, it is 0.
In this page I document.write a little message based on the value of these two variables. You'll have to decide exactly what to do with the information this script provides, especially what to do if you don't know if Flash is installed.
So, now you need to decide what to do with those. You say you want to redirect to index2.htm or to needflash.htm (auto install is out of the question). There is a third possibility you haven't considered - failure of the script to detect anything or to not detect the version, leaving the question of whether the user has the Flash you require or not still open.
So, your detection page (index.htm) could look like so:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="Javascript">
<!--
var flashinstalled = 0;
var flashversion = 0;
MSDetect = "false";
if (navigator.plugins && navigator.plugins.length)
{
x = navigator.plugins["Shockwave Flash"];
if (x)
{
flashinstalled = 2;
if (x.description)
{
y = x.description;
flashversion = y.charAt(y.indexOf('.')-1);
}
}
else
flashinstalled = 1;
if (navigator.plugins["Shockwave Flash 2.0"])
{
flashinstalled = 2;
flashversion = 2;
}
}
else if (navigator.mimeTypes && navigator.mimeTypes.length)
{
x = navigator.mimeTypes['application/x-shockwave-flash'];
if (x && x.enabledPlugin)
flashinstalled = 2;
else
flashinstalled = 1;
}
else
MSDetect = "true";
// -->
</SCRIPT>
<SCRIPT LANGUAGE="VBScript">
on error resume next
If MSDetect = "true" Then
For i = 2 to 12
If Not(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then
Else
flashinstalled = 2
flashversion = i
End If
Next
End If
If flashinstalled = 0 Then
flashinstalled = 1
End If
</SCRIPT>
<script type="text/javascript">
if(flashinstalled==2&&flashversion>=8)
window.location.replace('index2.htm')
else if(flashinstalled&&flashversion)
window.location.replace('needflash.htm')
</script>
</head>
<body>
Flash detection Failed, choose:<br>
<a href="index2.htm">I have Flash 8 or better</a><br>or<br>
<a href="needflash.htm">I need Flash or an Upgrade</a>
</body>
</html>
Just make sure to edit these red parts so that they reflect the correct page locations and Flash version you are after:
Code:
<script type="text/javascript">
if(flashinstalled==2&&flashversion>=8)
window.location.replace('index2.htm')
else if(flashinstalled&&flashversion)
window.location.replace('needflash.htm')
</script>
</head>
<body>
Flash detection Failed, choose:<br>
<a href="index2.htm">I have Flash 8 or better</a><br>or<br>
<a href="needflash.htm">I need Flash or an Upgrade</a>
Bookmarks