when assigning an object to the ObjectForScripting
property of a WebBrowser control the methods of this object can be called by JavaScript by using windows.external.[method_name]
. This works without problems.
But how I need to design this C# object when I have a JavaScript function like this (accessing a sub object): window.external.app.testfunction();
I tested it with following C# object assigned to the ObjectForScripting
property:
[ComVisible(true)]
public class TestObject
{
public App app = new App();
}
public class App
{
public void testfunction()
{
}
}
But this unfortunately does not work and leads to a JavaScript error saying "function expected".
Any idea on how the C# object has to look like that this JavaScript command is working?
Thank you for any tips on that
Andreas
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…