I have a WebBrowser control. I have added some JavaScript into the head tag and I can see it is working as expected by adding an alert. Inside of this js I am creating a function and adding some members to it's prototype like so:
function test() {
}
test.prototype.run = function() {
alert('success!')
}
function createTest() {
return new test()
}
Then back inside of C# I am doing:
dynamic test = this.browser.InvokeScript("createTest");
test.run();
I can see that the test object is some ComObject but when I call run() nothing happens. I get no error but nothing happens. Does anyone know how to call this type of custom object?
Also suppose I wanted to get rid of the createTest() method, how can I create a new instance of test from C#?
Also, for bonus points, is there anything special I need to know about attaching events to this custom object (on say a 'complete' member) such that it will callback into my C# code?