当前位置: 首页 > news >正文

浏览器CEFSharp88+X86+win7 之多页面展示(四)

代码


/// <summary>
/// cef浏览器全局设置
/// </summary>
public class CefHelper
{/// <summary>/// 初始化cef引擎/// </summary>public static void 东方仙盟_浏览器88初始化(){var settings = new CefSettings(){Locale = "zh-CN",AcceptLanguageList = "zh-CN,zh;q=0.8",PersistSessionCookies = true,UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0 Safari/537.36",IgnoreCertificateErrors = true,LogSeverity = LogSeverity.Disable, //禁用日志//为空则将以“隐身模式”创建浏览器//CachePath = AppDomain.CurrentDomain.BaseDirectory + "cef_cache",//Windows上用户“Local Settings\Application Data\CEF\User Data”目录UserDataPath = AppDomain.CurrentDomain.BaseDirectory + "cef_temp"};settings.CefCommandLineArgs.Add("disable-gpu", "1"); // 禁用gpusettings.CefCommandLineArgs.Add("no-proxy-server", "1"); //禁用代理settings.CefCommandLineArgs.Add("proxy-auto-detect", "0"); //禁用代理//settings.CefCommandLineArgs.Add("proxy-server", "ProxyAddress");settings.CefCommandLineArgs.Add("--disable-web-security", "1"); //允许跨域settings.CefCommandLineArgs.Add("--ignore-urlfetcher-cert-requests", "1");//忽略安全证书settings.CefCommandLineArgs.Add("--ignore-certificate-errors", "1");//忽略安全证书settings.CefCommandLineArgs.Add("enable-media-stream", "1"); //允许webRTC//settings.CefCommandLineArgs["enable-system-flash"] = "1";//settings.CefCommandLineArgs.Add("ppapi-flash-version", "32.0.0.171");//settings.CefCommandLineArgs.Add("ppapi-flash-path", @"plugins\pepflashplayer.dll");Cef.EnableHighDPISupport();CefSharpSettings.ConcurrentTaskExecution = true;//CefSharpSettings.LegacyJavascriptBindingEnabled = true;Cef.Initialize(settings);}/// <summary>/// 关闭cef引擎/// </summary>public static void Shutdown(){Cef.Shutdown();try{Directory.Delete($"{AppDomain.CurrentDomain.BaseDirectory}GPUCache", true);Directory.Delete($"{AppDomain.CurrentDomain.BaseDirectory}cef_temp", true);}catch{}}
}

前端


//CefSharp.BindObjectAsync('myClass');
//myClass.say();

CefSharp.BindObjectAsync('myClass').then(function (result) {
    myClass.say();
});


---------------------------------------------------------------------------------------------

后端执行js

//不带参数
webview.ExecuteScriptAsync("myClass.say()");

//带参数
var p = {
    say2: function (txt) { //前端对象方法
        alert(txt);
    }
}
webview.ExecuteScriptAsync("p.say2","这是参数");

//执行有返回值的js
var res = await webview.EvaluateScriptAsync("p.say2","asdas");
MessageBox.Show(res.Result.ToString());

form代码


public static ChromiumWebBrowser webview;
public FrmMain()
{webview = new ChromiumWebBrowser(App.WebUrl);webview.Dock = DockStyle.Fill;webview.DownloadHandler = new DownloadHandler();webview.MenuHandler = new MenuHandler();webview.JavascriptObjectRepository.Register("myClass", new AAA(), true);Controls.Add(webview);CheckForIllegalCrossThreadCalls = false;InitializeComponent();}

引用库

CefSharp.Core.dll
CefSharp.dll
CefSharp.WinForms.dll右键属性==>不要生成到目录

解压

CefSharp.H264.x86.88.4.2.nupkg

资源文件

NuGet Gallery | CefSharp.H264.x86 133.4.2

环境要求

.NETFramework 4.5.2

新版特性

以下是一些注意事項:

  • 您現在可以使用  將擴充功能上傳至 Chrome 線上應用程式商店。
  •  CSS 屬性可讓您輕鬆設定任何元素的顯示比例。
  • Chrome 88 會在特定情況下,隱藏網頁的鏈結 JavaScript 計時器。
  • 您現在可以在受信任的網路活動中使用
  • 的所有影片都已上線。

我是現在在家工作並拍攝影片,讓我們一起來看看 Chrome 88 有哪些新功能可供開發人員使用!

Manifest V3

Chrome 88 現已支援使用 Manifest V3 建構的擴充功能,您可以將這些擴充功能上傳至 Chrome 線上應用程式商店。Manifest V3 是全新的擴充功能平台,可讓 Chrome 擴充功能在預設情況下更安全、效能更佳,並尊重隱私權。

舉例來說,這項政策禁止遠端代管程式碼,有助於 Chrome 線上應用程式商店審查人員更清楚瞭解擴充功能可能帶來的風險。並且應該可讓您更快更新擴充功能。

這項功能會引入服務工作者,取代背景頁面。由於服務工作者只會在需要時駐留在記憶體中,因此擴充功能會使用較少的系統資源。

為了讓使用者更清楚瞭解擴充功能如何使用及分享其資料,並進一步控管相關設定,我們將在日後的版本中採用新的安裝流程,讓使用者在安裝時拒絕敏感權限。

請造訪進一步瞭解相關詳情,以及如何將目前的擴充功能遷移至 Manifest V3

阿雪技术观

在科技发展浪潮中,我们不妨积极投身技术共享。不满足于做受益者,更要主动担当贡献者。无论是分享代码、撰写技术博客,还是参与开源项目维护改进,每一个微小举动都可能蕴含推动技术进步的巨大能量。东方仙盟是汇聚力量的天地,我们携手在此探索硅基生命,为科技进步添砖加瓦。

Hey folks, in this wild tech - driven world, why not dive headfirst into the whole tech - sharing scene? Don't just be the one reaping all the benefits; step up and be a contributor too. Whether you're tossing out your code snippets, hammering out some tech blogs, or getting your hands dirty with maintaining and sprucing up open - source projects, every little thing you do might just end up being a massive force that pushes tech forward. And guess what? The Eastern FairyAlliance is this awesome place where we all come together. We're gonna team up and explore the whole silicon - based life thing, and in the process, we'll be fueling the growth of technology.

http://www.lryc.cn/news/616373.html

相关文章:

  • NodeJs学习日志(4):路由合并_环境配置_常用文件目录
  • element-ui el-progress在有小数的情况下,会换行显示。解决不换行的问题。
  • iceberg安装部署
  • Rust面试题及详细答案120道(11-18)-- 控制流与函数
  • vulnhub-Drippingblues靶机
  • 通过Certbot自动申请更新HTTPS网站的SSL证书
  • 瑞芯微 RK3588 平台驱动开发 学习计划
  • CST支持对哪些模型进行特征模仿真?分别有哪些用于特征模分析的求解器?
  • C语言——深入理解指针(二)
  • 【东枫科技】FR3 可扩展测试平台,适用于 6G 研究与卫星通信,高达 1.6 GHz 的带宽
  • 【秋招笔试】2025.08.09美团秋招算法岗机考真题-第三题
  • Python 的浅拷贝 vs 深拷贝(含嵌套可变对象示例与踩坑场景)
  • OpenGL VAO 概念、API 和示例
  • 每日一题:使用栈实现逆波兰表达式求值
  • TypeScript中的type和interface的区别是什么?
  • 从街亭失守看管理
  • WAV音频数据集MFCC特征提取处理办法
  • 【MySQL——第三章 :MySQL库表操作】
  • 如何选择适合自己电商业务的 API?​
  • DBAPI 实现不同角色控制查看表的不同列
  • 七、CV_模型微调
  • 使用快捷键将当前屏幕内容滚动到边缘@首行首列@定位到第一行第一个字符@跳转到4个角落
  • Knuth‘s TwoSum Algorithm 原理详解
  • 每日任务day0810:小小勇者成长记之武器精炼
  • 机器学习 DBScan
  • VUE+SPRINGBOOT从0-1打造前后端-前后台系统-关于我们
  • 人大地平线新国立单目具身导航新范式!MonoDream:基于全景想象的单目视觉语言导航
  • 周学会Matplotlib3 Python 数据可视化-绘制折线图(Lines)
  • python中re模块详细教程
  • 论文阅读:Aircraft Trajectory Prediction Based on Residual Recurrent Neural Networks