admin管理员组

文章数量:1418380

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.

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.

Share Improve this question edited Sep 17, 2009 at 7:30 Matthew Lock asked Sep 17, 2009 at 7:19 Matthew LockMatthew Lock 13.6k14 gold badges97 silver badges132 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

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 plete working code.

Good luck MikeD

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.

本文标签: javascriptDetect Google Earth is installed in a web page on Internet ExplorerStack Overflow