2012-05-04 52 views
1

有什麼方法可以檢測谷歌地球插件完成安裝,所以我可以自動刷新頁面?谷歌地球插件自動刷新

即使安裝時沒有事件觸發,也許我可以定期檢查一次javascript間隔是否已安裝?

回答

1

您可以使用此功能每秒檢查一次插件支持,以及是否安裝。

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?