Could someone explain part of this function?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Could someone explain part of this function?

From: Nick <nick@gpmarquees.co.uk>
Date: Tue Jan 31 2006 - 18:57:24 CET

Hi
I have managed to Plagiarize and modify a piece of script that checks
to see if JAVA is installed on the users pc:

function javaInstalled()
{
        result = false;
        if (navigator.mimeTypes &&
navigator.mimeTypes["application/x-java-vm"])
        {
                result = navigator.mimeTypes["application/x-java-vm"].enabledPlugin;
        }
                else if (document.all && (navigator.appVersion.indexOf("Mac")==-1))
        {
                        // IE Windows only -- check for ActiveX control, have to hide code
in eval from Netscape (doesn't like try)
                eval ('try {var xObj = new ActiveXObject("Javaplugin");if
(xObj) result = true; xObj = null; } catch (e) {}');
        }
        return result;
}

if (javaInstalled())
{
//do nothing
 }
else
{
newWindow = window.open('../nojava.html', 'newWin',
'width=420,height=250')
}

I have tried it on a machine that doesn't have JAVA installed and it
works exactly as i want it to. I can't however figure out what the
"eval ('try {var xObj = new ActiveXObject("Javaplugin");if
(xObj) result = true; xObj = null; } catch (e) {}');"
 bit means and it's importance, i know it doesn't work if its not
present!!!
Any help would be appreciated and also if it would work with Netscape(
not sure what the comment is saying)

Thanks

Nick
Received on Tue Feb 7 21:29:01 2006