問(wèn)題描述
有沒(méi)有辦法通過(guò)javascript檢測(cè)主流瀏覽器(firefox,即chrome、safari和opera)中的flash插件崩潰?
Is there any way to detect flash-plugin crashes in major browsers (firefox, ie, chrome, safari and opera) via javascript?
推薦答案
我不確定這是否有效.您可以定期獲取對(duì) flash 對(duì)象的引用,并檢查它是否具有 SetVariable 方法.
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 是一個(gè)可以從 Javascript 代碼中調(diào)用的接口函數(shù).如果 flash 崩潰了,它的界面也應(yīng)該崩潰.因此,這可能是一個(gè)解決方案.
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.
這篇關(guān)于檢測(cè) FLASH 插件崩潰的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!