Re: Detecting plugin activation state

Benjamin Smedberg <[email protected]> Tue, 08 Oct 2013 11:57:03 -0400
Newsgroups gmane.comp.mozilla.devel.plugins
Message-ID <[email protected]>
On 10/3/2013 1:11 PM, Mitchell Laurren-Ring wrote:
> Is it possible to detect whether a plugin is activated via Javascript?
The recommended way to do this is simply expose a property on the plugin 
(via NPRuntime scripting) which you can check. It's also a good 
practice, if the site needs to know when a plugin is activated, to 
provide a callback API, for example:

<script>
function pluginInstantiated(pluginElement)
{
   // Because we pass instantiated="pluginInstantiated" below, this 
function will be called when the plugin is set up
}
</script>

<embed type="application/x-myplugin" createdcallback="pluginInstantiated">

You can do this with Flash using the externalInterface API.

--BDS