MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla

Compare Revisions

Site Author Guide for Click-To-Activate Plugins

Change Revisions

Revision 482157:

Revision 482157 by BenjaminSmedberg on

Revision 482169:

Revision 482169 by gfritzsche on

Title:
Site Author Guide for Click-To-Activate Plugins
Site Author Guide for Click-To-Activate Plugins
Slug:
Site_Author_Guide_for_Click-To-Activate_Plugins
Site_Author_Guide_for_Click-To-Activate_Plugins
Tags:
"Plugins"
"Plugins"
Content:

Revision 482157
Revision 482169
tt57    <h3>
58      Use Properties on the Plugin to Determine When it Activated
59    </h3>
60    <p>
61      When you are using a plugin that doesn't allow specifying c
 >allbacks and you can't modify it, an alternative technique is to 
 >test for properties that the plugin should have:
62    </p>
63    <pre>
64&lt;body onload="checkPlugin()"&gt;
65&lt;script&gt;
66function checkPlugin()
67{
68  if (document.getElementById('myPlugin').propertyAndMethod !== u
 >ndefined) {
69    document.getElementById('myNotification').style.display = 'no
 >ne';
70    document.getElementById('myPlugin').callPluginMethod();  
71  } else {
72    console.log("Plugin not activated yet.");
73    setTimeout(checkPlugin, 500);
74  }
75}
76&lt;/script&gt;
77 
78&lt;p id="myNotification"&gt;Waiting for the plugin to activate!&
 >lt;/p&gt;
79&lt;object id="myPlugin" type="application/x-my-plugin"&gt;&lt;/o
 >bject&gt;
80</pre>

Back to History