cefsharp
2024-10-19 00:20:07
快速上手
js和C#互相调用。
C#调用js比较容易。JS调用C#代码,现有两种方法。老方法的缺点是只支持单页,如果切换页面,原有创建的变量就失效了。新方法没有这些问题。
老方法:
Cefsharp js调用c#与c#调用js
CefSharp 与 js 相互调用
新方法
https://github.com/cefsharp/CefSharp/issues/2246
var options = new CefSharp.BindingOptions() {CamelCaseJavascriptNames = false};
var bindingOptions = options; //For async object registration (equivalent to RegisterJsObject)
this.Browser.JavascriptObjectRepository.Register("boundAsync", new BoundObject(), true, options);
this.Browser.JavascriptObjectRepository.Register("boundAsync2", new AsyncBoundObject(), true, options);
<script type="text/javascript">
function aa()
{
// <embed user provided code here>
CefSharp.BindObjectAsync("boundAsync", "bound").then(function (result) {
boundAsync.hello('CefSharp');
}); };
function bb(){
CefSharp.BindObjectAsync("boundAsync2").then(function(result)
{
boundAsync2.hello('CefSharp');
});
} </script>
参考链接:
快速开始
https://github.com/cefsharp/CefSharp/wiki/Quick-Start
wpf中使用
https://www.codeproject.com/Articles/881315/Display-HTML-in-WPF-and-CefSharp-Tutorial-Part
官方demo
https://github.com/cefsharp/CefSharp.MinimalExample
博客园博客
https://www.cnblogs.com/M-Silencer/p/5846494.html
最新文章
- 性能优化九之UI卡顿分析
- winform程序自动升级
- jquery/js实现验证聚焦,失焦
- 提高Web页面性能的技巧
- android之硬件访问服务框架
- JNI 多线程
- Apache无法启动解决方案
- iOS开发之第三方登录QQ -- 史上最全最新第三方登录QQ方式实现
- 新服务器sudo与权限分配<;NIOT>;
- ArrayList类
- Unity使用Mono.Xml代替System.Xml 测试
- The JRE_HOME environment variable is not defined correctly
- 把一个List拆分为几个大小一样的List
- dojo:如何为表格添加从数据库获得存储的下拉框
- 图片路径中含有中文在jsp下不能正常显示的问题
- c# 策略模式 加工厂模式-对象与行为分离
- Hadoop源码阅读-HDFS-day2
- Scala + Thrift+ Zookeeper+Flume+Kafka配置笔记
- JQuery this和$(this)的区别
- javascript实现数据结构: 树和森林
热门文章
- 如何从jks文件中导出公私钥
- python r r+ w w+ rb 文件打开模式的区别
- oracle的常用99条语句
- 697. Degree of an Array
- 2018.11.06 bzoj1835: [ZJOI2010]base 基站选址(线段树优化dp)
- Linux下启动tomcat报错RROR org.apache.catalina.core.StandardContext- Error starting static Resources java.lang.IllegalArgumentException: Document base /home/duiba/apache-tomcat/webapps/../webapps/manager do
- IntellJ IDEA2017 springboot2.0.2中读取配置
- poj 1125 Stockbroker Grapevine(最短路径)
- Ng第十五课:异常检测(Anomaly Detection)
- (转)ASP.NET MVC 3和Razor中的@helper 语法