detect when google earth plugin crash

扶醉桌前 提交于 2020-01-05 05:40:28

问题


There is a way to detect from javascript if the google earth plugin is crashed, so I can reload automatically the page without user action? Thanks


回答1:


I don't think you can directly assess whether the plug-in has crashed. However, you could set up an endless timer that is constantly checking something like getView()

function hasCrashed() {
     try {
          var view = ge.getView();
          if (view) {
          // plugin good
          } else {
          // plugin not good
          }
     } catch (e) {
         // plugin not good
     }
     // a timer that checks every second
     setTimeout('hasCrashed()', 1000);
}

I haven't tested that, but it should work. If not, try other options besides from getView() - perhaps getWindow() or getGlobe() options



来源:https://stackoverflow.com/questions/12688626/detect-when-google-earth-plugin-crash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!