gpt4 book ai didi

javascript - 检测 Google Earth 安装在 Internet Explorer 的网页中

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:38:36 25 4
gpt4 key购买 nike

是否可以在 Internet Explorer 的网页中检测是否使用 Javascript 在客户端计算机上安装了 Google 地球应用程序?

此页面是 Intranet 上可信站点的一部分。

更新:通过创建 ActiveX 对象或任何 IE 特定的 javascript 检测它是可以的。

最佳答案

是的,这是可能的 - 在您的 html 页面上,您调用 API 的 init 函数

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

在 JavaScript 中,当为您的页面创建一个 GE 实例时,您为错误调用的回调函数提供了一个函数指针

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

最后 - 在该函数中检查错误代码

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

this一个完整的工作代码。

祝你好运迈克D

关于javascript - 检测 Google Earth 安装在 Internet Explorer 的网页中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1437204/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com