server端代码:
ChromiumWebBrowser wb; wb.AddGlobalJSFunction("CfxHelloWorld").Execute += CfxHelloWorld_Execute; void CfxHelloWorld_Execute(object sender, CfrV8HandlerExecuteEventArgs e) { MessageBox.Show("调用成功!"); }
JS调用代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title></title> </head> <body> <button onclick="CfxHelloWorld()">点击调用C#</button> </body> </html>
本文转自mfrbuaa博客园博客,原文链接:http://www.cnblogs.com/mfrbuaa/p/5238112.html,如需转载请自行联系原作者