I'm using the following code in the init of a custom
client-side web component.
objWebService = document.createElement("div");
objWebService.style.display = "none";
objWebService.style.behavior = "/theDir/webservice.htc";
objWebService.id = "WebServiceObject";
parentElement.appendChild(objWebService);
objWebService.useService("/theDir/MCInterface.asmx?
WSDL","MCI");
This object must be created at runtime on the client
side. The files exist and are reachable, it seems, but
when I run this code, it has a problem with the last line,
telling me that the "Object doesn't support this property
or method." I assume it's taking about the useService()
method.
I've done some fiddling and I added <PUBLIC:ATTACH
EVENT="onload" HANDLER="DoInit" /> to the webservice.htc
file. I also tried this with oncontentready.
This code doesn't seem to be called. I wrote a function
that displays the current code in a new window and the
object does show up in the document:
<DIV id=WebServiceObject style="DISPLAY: none;
BEHAVIOR: /theDir/webservice.htc"></DIV>
how do behaviors work when being added after the page is
finished loading? Why isn't this working overall?
Jason Kleban - 13 Aug 2003 18:38 GMT
For a test, I hard coded the div that has the behavior and
the init code is still not running and the object still
doesn't support the method, but the object is found and is
not null, and if I change the name of what I'm looking
for, it is null.
I have two htc files. One is definately loading, the one
that's calling the webservice, and the webservice htc,
which appears not to be.
If I try to download either file directly, however, I get
an IE popup message box without delay:
"Internet Explorer cannot download [file] from [site].
Internet Explorer was not able to open this Internet site.
The requested site is either unavailable or cannot be
found. Please try again later."
But again, one of these files is what defines the
behaviors that I am seeing on the page. I've cleared my
cache too. Changes in the code are reflected as well.