I think this should help you:
http://www.west-wind.com/WebLog/posts/493536.aspx
EDIT: Based on this link, here is a small sample application. Add a Button and WebBrowser control to your Windows form and add this code:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.webBrowser1.DocumentText = @"<html>
<body>
<script type = ""text/javascript"">
function ShowMessage(text) {
alert(text);
}
</script>
</body>
<input type=""button"" onclick=""ShowMessage('From JavaScript')"" value=""Click me""/>
</html>";
}
private void button1_Click(object sender, EventArgs e)
{
this.webBrowser1.Document.InvokeScript("ShowMessage",new object[]{"From C#"});
}
}
If you click the button in the browser, it will show the javascript message, if you click the button in the form of a window, it will show the C # message.
Bfree source
share