Test for existence of the Cortona 3D plugin

If you want to check whether your visitor has the Cortona 3D viewer plugin installed in the browser, you can use the following javascript:

<script type="text/javascript">
    var isIE  = !!(navigator.appVersion.indexOf("MSIE") != -1);
    var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var cortonaPossible = isWin;// is the plugin available for this platform
    var cortonaInstalled = false;// is the plugin actually installed
var cortonaChecked = false;// if 'cortonaPossible': did we do a check to find out if we have the plugin installed. This in case of new browsers whoch are not supported by this check
    if (cortonaPossible)
    {
cortonaChecked = true;
        if (navigator.plugins && navigator.plugins.length)
        {
            for (var i = 0; i < navigator.plugins.length; i++)
            {
                if (navigator.plugins[i].name.toLowerCase().indexOf('cortona3d') > -1)
                    cortonaInstalled = true;
            }
        // detect VRML and X3D plugins in Microsoft Internet Explorer, only with Windows
// copied from http://cic.nist.gov/vrml/vbdetect.html
        } else if (navigator.appName == "Microsoft Internet Explorer" && isWin)
        {
            // IEDetectObject is used to detect ActiveX Controls
            document.writeln('<SCRIPT LANGUAGE="VBScript">');
            document.writeln('function IEDetectObject(activeXControlName)');
            document.writeln('    On Error Resume Next');
            document.writeln('    IEDetectObject = IsObject(CreateObject(activeXControlName))');
            document.writeln('End function');
            document.writeln('</SCR' + 'IPT>');
            if (IEDetectObject('Cortona.Control.1'))
                cortonaInstalled = true;
        } else
            cortonaChecked = false;
    }
</script>

Thanks to the source code of http://cic.nist.gov/vrml/vbdetect.html !

del.icio.us Digg StumbleUpon Facebook Technorati Fav reddit Google Bookmarks
| Viewed 135 times

No comments yet.

(will not be published)
Leave this field empty: