Shoutbox

Javascript (detect Flash) - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Javascript (detect Flash) (/showthread.php?tid=67395)

Javascript (detect Flash) by Nathan on 10-16-2006 at 09:00 PM

Ok,
I need some javascript for a site which checks if the user has flash installed and if it is installed what version it is!
Can anyone do it please?
Cheers,
Nathan


RE: Javascript by Dempsey on 10-16-2006 at 09:04 PM

code:
<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 6
        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>

Source:     http://www.quirksmode.org/js/flash.html
RE: Javascript by Nathan on 10-16-2006 at 09:06 PM

dempsey, if you had said you had coded that yourself my uncle would of paid you. :P
and thanks =p


RE: Javascript by Spunky on 10-19-2006 at 06:29 PM

Erm, doesn't Flash have an option to check for certain versions when you publish the HTML file as well? Thats what I usually do...


RE: Javascript by vaccination on 10-19-2006 at 10:14 PM

quote:
Originally posted by SpunkyLoveMuff
Erm, doesn't Flash have an option to check for certain versions when you publish the HTML file as well? Thats what I usually do...

Yeah it does, but maybe Nathan is doing something different. Somehow :P