What is the best method for detecting that flash will load across browsers?
Hi,
I'm aware that we can always use navigator.plugins to check for the presence of flash in most browsers. However, if the 'Shockwave Flash' plugin is there, is it safe to assume that a swf object will always load successfully? It appears to be the case thus far -- however is it safe to additionally inject a test SWF object into the DOM to see if it loads correctly?
For example:
function createFlashDetectObject() {
const obj = document.createElement('object');
obj.id = 'flashCheck';
obj.setAttribute('type', 'application/x-shockwave-flash');
document.body.appendChild(obj);
obj.style.position = 'absolute';
obj.style.left = '-999px';
obj.style.top = '-999px';
return obj;
}
function initFlashCheck(){
const object = createFlashDetectObject();
setTimeout(() => {
const isFlashEnabled = (object.StopPlay !== undefined);
console.log('isFlashEnabled', isFlashEnabled);
}, 1000);
}
initFlashCheck();
Best,
Amal
