Search code examples
javascriptgoogle-earth-plugin

detect when google earth plugin crash


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


Solution

  • 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