views:

507

answers:

2

Is it possible in web page on Internet Explorer to detect if the Google Earth application is installed on the client machine using Javascript?

This page is part of a Trusted Site on an intranet.

Update: detecting it via creating an ActiveX object or any IE specific javascript is fine.

+2  A: 

I don't think this works using Javascript. I'm pretty sure Google Earth doesn't install a plugin into Internet Explorer (or any other browser for that matter). So you can forget Javascript.

As you are on a trusted site you may try using ActiveX. I'm not into ActiveX but maybe there's a way to have a deeper look into the client's system.

Koraktor
+3  A: 

yes it is possible - on your html page you call the init function for the API

<body onload="init()">
   bla bla bla 
</body>

In a JavaScript, when creating a GE instance for your page, you provide a function pointer for a callback function called on errors

function init()
{
    if (ge == null)
    {
        google.earth.createInstance("content", initCallback, failureCallback);
    }
}

finally - in that function you check the error code

function failureCallback(errorCode)
{
    if (errorCode == "ERR_CREATE_PLUGIN") {
        alert("Plugin not installed")
    } else {
        alert("Other failure loading the Google Earth Plugin: " + errorCode);
    }
}

look at this for a complete working code.

Good luck MikeD

MikeD
Thanks for this. It seems to detect the GE plugin. Does that get installed when you install regular GE? Regular GE is what I want to detect is installed.Matthew
Matthew Lock
oops sorry - seems I misinterpreted your questionsyes - this detects the GE API pluginno - this does not detect if a regular GE is installedno - the GE plugin is not installed when you install regular GE
MikeD