Reputation: 1623
I have a winform application that contains a c# webbrowser control.Webbrower control load a html page. On that html page I have a button. What I want is when click that button, it will call a winform function(function in Form1.cs for example). Is it possible? Please help me
Upvotes: 0
Views: 828
Reputation: 4866
Use window.external object in your scripting code to access public properties and methods of the specified object. (See the sample in the link)
C#
public void Test(String message)
{
MessageBox.Show(message, "client code");
}
HTML
<button onclick="window.external.Test('called from script code')">
call client code from script code
</button>
Upvotes: 1