views:

666

answers:

1

I'm working with some code in C#.NET for an Internet Explorer extension that calls Javascript in the browser and gets the return value from the Javascript call. When the Javascript returns a primitive type or an array of primitive types, I get something that I can deal with, but when the Javascript returns an object, I get an opaque COM object.

How can I get at the contents of the COM object, or is there a better way to call into IE from C#.NET?

+1  A: 

Take a look at the remarks at the bottom of the InvokeMember documentation. If the return value is a javascript object, you are receiving a .NET Object wrapper around the javascript object. You will have to use reflection to inspect/invoke the members of the underlying javascript object. This makes perfect sense, since javascript is a dynamic language and C# is not.

jlew