Detect FLASH plugin crashes

2019-02-09 11:26发布

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

4条回答
在下西门庆
2楼-- · 2019-02-09 11:44

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.

查看更多
别忘想泡老子
3楼-- · 2019-02-09 11:44

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.

查看更多
迷人小祖宗
4楼-- · 2019-02-09 11:44

It depends how you feel about false positives.

You can have a watchdog that make a ajax call "The flash has not crashed", if the flash seems to still be working. And asume that flash has crashed if is not written. This will create false positives if the user close the page before the check.

You can have a watchdog that make a ajax call "The flash has crashed", if the flash seems to not work. This will miss crashes, like crash that kill the whole browser with it.

Maybe you can have both watchdogs so you get a better idea of whats going on.

查看更多
forever°为你锁心
5楼-- · 2019-02-09 11:49

Use global exception handling in ActionScript to call an external interface on UncaughtErrorEvent.UNCAUGHT_ERROR.

When an error occurs in the Flash Player runtime, it may catch the exception and signal JavaScript.

查看更多
登录 后发表回答