P
Phil
Hi,
I am trying to dynamically embed an object into a webpage using
javascript.
The object i am trying to embed is:
<embed type="application/x-Immersion-Web-Plugin" name="ImmWeb"
hidden="true"></embed>
Later on in the code I access
document.ImmWeb.MakeConstant("MyConstant");
which works fine.
However I want to embed the object dynamically, so I created a function
which does the following:
var embedObj = document.createElement("embed");
embedObj.setAttribute('type' ,'application/x-Immersion-Web-Plugin');
embedObj.setAttribute('name' ,'ImmWeb');
embedObj.setAttribute('hidden','true');
var body = document.getElementsByTagName("body")[0];
body.insertBefore(embedObj, body.firstChild);
This function is called when I load the page (onLoad). However I can no
longer use:
document.ImmWeb.MakeConstant("MyConstant");
as the javascript debugger states that this "is not a function". The
only things I can access via document.ImmWeb are the attributes stated
above (type, name and hidden). When the object is embedded normally
there is a lot of other methods that can be accessed. (Note the
application/x-Immersion-Web-Plugin is a component that has been
installed)
Am i missing something - is it not possible to dynamically embed
objects? Is there some call i have to make somewhere to update
something!
Thanks
Phil
I am trying to dynamically embed an object into a webpage using
javascript.
The object i am trying to embed is:
<embed type="application/x-Immersion-Web-Plugin" name="ImmWeb"
hidden="true"></embed>
Later on in the code I access
document.ImmWeb.MakeConstant("MyConstant");
which works fine.
However I want to embed the object dynamically, so I created a function
which does the following:
var embedObj = document.createElement("embed");
embedObj.setAttribute('type' ,'application/x-Immersion-Web-Plugin');
embedObj.setAttribute('name' ,'ImmWeb');
embedObj.setAttribute('hidden','true');
var body = document.getElementsByTagName("body")[0];
body.insertBefore(embedObj, body.firstChild);
This function is called when I load the page (onLoad). However I can no
longer use:
document.ImmWeb.MakeConstant("MyConstant");
as the javascript debugger states that this "is not a function". The
only things I can access via document.ImmWeb are the attributes stated
above (type, name and hidden). When the object is embedded normally
there is a lot of other methods that can be accessed. (Note the
application/x-Immersion-Web-Plugin is a component that has been
installed)
Am i missing something - is it not possible to dynamically embed
objects? Is there some call i have to make somewhere to update
something!
Thanks
Phil