How to detect if native FlashBlock is enabled in Chrome (and others)?
Chrome has bundled a "native" flashblock for a while, as has the android browser. swfobject reports that the flash player is available, even if the block is enabled for all sites. All I want to do is detect that a user is using native flashblock, and provide some messaging. Certain services, like the Facebook JS SDK, do not work without flash enabled for cross-domain communication, and do not provide methods of detecting failure. I know how to detect an extension/plugin like the original flashblock, but the native version does not appear in the navigator.plugins list.
Is there a way开发者_StackOverflow社区 to detect if a user is running with a native flashblock enabled?
Unfortunately, there's no programatic interface to the plugin-loading system in Chrome.
The best you can do is to load a flash object, and poll it via some well-defined method (GetVariable("$version")
is the canonical example) to determine success. In the case you're concerned with, flash will show up in navigator.plugins
, but won't successfully load your test plugin. It's really not a bad idea to do this sort of check anyway, as there are a number of reasons that flash might not load, above and beyond flash-blocking (native or otherwise).
精彩评论