What steps will reproduce the problem?
1. Create a DIV-object dynamically (createElement) called divobj.
2. Fill the innerHTML property with "<object TYPE='application/plugin' ...
param_... ></object>" to load the desired control.
3. divobj.firstChild should point to the created object now (like in
Internet Explorer)
4. Calling any method on this object fails.
What is the expected output? What do you see instead?
Expected: The method of the created object gets executed
Instead: Error stating that the method is undefined.
What version of the product are you using? On what operating system?
r25, XP, FF 3.0.6
Please provide any additional information below.
When step 4 is executed in another pseudo-"thread" (using setTimeout), it
works. When a messagebox (alert) is displayed after step 3, step 4 also
succeeds and the method is called.
I suspect Firefox not to update its DOM-tree correctly after inserting the
object dynamically. The tree gets updated when FF regains control e.g. the
object-creating thread is suspended using alert or setTimeout.
Yes, you cannot script the object directly after creating it dynamically (i.e. using Javascript). Creating the DOM element does not mean that the plugin was loaded & initialized, that an instance to handle the object was created and that the ActiveX control was already loaded, initialized and is already accessible. When you try to access a method/property of the control, the plugin attempts to resolve it using the COM component's embedded type info, the error you are getting means the component was not completely loaded yet, and that the member you tried to access is not found. When creating objects of this plugin dynamically (I'm doing that myself in my own web application), you want to separate the creation of the DOM element from the code that attempts to access the ActiveX component. In my web app I'm doing it all under the OnReady document handler, just separated with enough code in between to make sure the component has had enough time to finish its init phase. A more bulletproof approach is to use the onreadystatechange event handler, as shown in the examples in the documentation wiki and on the front page of this project. Here's a full example with a javascript handler: {{{ <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> ActiveX Host Test Page </title> </head> <body> <object id="Control" TYPE="application/x-itst-activex" WIDTH="300" HEIGHT="300" progid="ShockwaveFlash.ShockwaveFlash" event_OnReadyStateChange="OnReady" param_src="http://www.youtube.com/v/53RdNYwImYc"> </object> <script type='text/javascript'> function OnReady(state) { console.log(state); } </script> </body> </html> }}} On a side note, the behavior of IE7 in this regard has changed from IE6, and when creating objects dynamically, you need to wait on that event as well. As it stands, there is a solid workaround to this issue, and there's not much to be done in the context of this plugin that can change this behavior. I'm setting this issue to 'WontFix'. Feel free to contact me here or on the project's discussion group.Owner: leeor.aharon