Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

problem with using WebBrowser.ObjectForScripting (C# + IE11)

$
0
0

Hello,
I try to extend my an instance of WebBrowser control with my class that I'd like to call via javascript from inside the page and I run into theissue. Here is the example that illustrates my problem. I have a class with 2 methods, like this:

 [ComVisibleAttribute(true)]
 public class WebBrowserExtra
 {
   public bool CanDoAction()   { return true;}
   public void DoAction(int objId) {InternalDoAction(objId);}
 }

I assign an instance of WebBrowserExtra to ObjectForScripting property of WebBrowser control.

If in javascript I call window.external.CanDoAction(), everything is OK - I can even put a break-point inside "CanDoAction" and see it being invoked. However as soon as javascript calls window.external.DoAction(1) an error is generated that reads"Class doesn't support automation". It seems like there is nothing helpful our there on the subject.

Any clue would be greatly appreciated - thank you.


software developer



Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>