views:

60

answers:

2

Is there any way to detect flash-plugin crashes in major browsers (firefox, ie, chrome, safari and opera) via javascript?

A: 

Maybe you could use a keep alive script in your as3 file that talks to the page js, if the js doesn't get a call for a few seconds, you could have it time out and handle it as a flash crash.

Gary Paluk
A: 

I'm not sure whether that works or not. You can periodically get a reference to flash object and check whether it has the method SetVariable.

function checkFlashCrashed() {
   try {
      var tmp = document.getElementById("flashObjectId").SetVariable;
      if(!tmp) {
         alert("Flash crashed");
         return;
      }
   } catch (e) {
      alert("Flash crashed");
      return;
   }
   setTimeout(checkFlashCrashed, 1000); // check it out every one second
}

SetVariable is an interface function that can be called from Javascript code. If flash crashes, its interface should crash, too. Hence, that may be a solution.

Zafer