Is there any way to detect flash-plugin crashes in major browsers (firefox, ie, chrome, safari and opera) via javascript?
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.
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.
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.
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.