有没有办法检测谷歌地球插件何时安装完毕,这样我才能自动刷新页面?
即使在安装时没有事件触发,也许我可以让javascript间隔定期检查它是否已安装?
发布于 2012-05-05 04:52:53
您可以使用此函数每秒检查一次是否支持插件以及是否已安装。
function googleEarthErrors() {
if (google.earth.isSupported()) {
alert('Google Earth Plugin is supported for this browser');
} else {
alert('Google Earth Plugin is NOT supported for this browser');
return false;
}
if (google.earth.isInstalled()) {
alert('Google Earth Plugin is installed');
} else {
alert('Google Earth Plugin is NOT installed');
setTimeout('googleEarthErrors()', 1000);
}显然,您会希望用更有用、更少烦人的东西来替换警报:)
另外,你应该看看这个答案-- How to check for presence of the google earth plugin using JavaScript?
https://stackoverflow.com/questions/10444577
复制相似问题