博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CEF浏览器代码收集
阅读量:5244 次
发布时间:2019-06-14

本文共 2618 字,大约阅读时间需要 8 分钟。

CEF浏览器配置

CefSettings cefSettings = new CefSettings();            cefSettings.Locale = "zh-CN";            cefSettings.CachePath = str + "cache";            cefSettings.AcceptLanguageList = "zh-CN";            //cefSettings.CefCommandLineArgs.Add("disable-application-cache", "1");            //cefSettings.CefCommandLineArgs.Add("disable-session-storage", "1");            Cef.Initialize(cefSettings);             CefSharpSettings.LegacyJavascriptBindingEnabled = true;
View Code

 RegisterJsObject

class JsEvent        {            public string MessageText = string.Empty;            public void showTest()            {                MessageBox.Show("this in C#.\n\r" + MessageText);                            }        }        void intjs(ExtChromiumBrowser chromiumWeb)        {            var JsEvent = new JsEvent();            chromiumWeb.RegisterJsObject("jsObj", JsEvent, BindingOptions.DefaultBinder);        }function myfunction(){     jsObj.MessageText = "hello";    jsObj.showTest();}
View Code

 COOKIE

class CookieClear : ICookieVisitor        {            public bool Visit(Cookie cookie, int count, int total, ref bool deleteCookie)            {                deleteCookie = true; return true;             }             public void Dispose() { }        }CookieClear cookieClear;            cookieClear = new CookieClear();            if (Cef.GetGlobalCookieManager().VisitAllCookies(cookieClear))            {             }
View Code

 COOK

public class CookieVisitor : ICookieVisitor        {            public CookieVisitor(string Domainurl)            {                Domain = Domainurl;            }            public event Action
SendCookie; public string cookies = ""; public string Domain; public bool Visit(CefSharp.Cookie cookie, int count, int total, ref bool deleteCookie) { deleteCookie = false; if (SendCookie != null) { SendCookie(cookie); cookies += cookie.Value; } return true; } public void Dispose() { } } static string cookies; /// 回调事件 private static void visitor_SendCookie(CefSharp.Cookie obj) { cookies += obj.Domain.TrimStart('.') + "^" + obj.Name + "^" + obj.Value + "$"; }CookieVisitor visitor = new CookieVisitor(); visitor.SendCookie += visitor_SendCookie; if (Cef.GetGlobalCookieManager().VisitAllCookies(visitor)) { }
View Code

 

转载于:https://www.cnblogs.com/bycnboy/p/9186510.html

你可能感兴趣的文章
代码变量、函数命名神奇网站
查看>>
redis cli命令
查看>>
Problem B: 占点游戏
查看>>
python常用模块之sys, os, random
查看>>
HDU 2548 A strange lift
查看>>
Linux服务器在外地,如何用eclipse连接hdfs
查看>>
react双组件传值和传参
查看>>
BNU29140——Taiko taiko——————【概率题、规律题】
查看>>
POJ 2289——Jamie's Contact Groups——————【多重匹配、二分枚举匹配次数】
查看>>
java 得到以后的日期
查看>>
[Kaggle] Sentiment Analysis on Movie Reviews
查看>>
python安装easy_intall和pip
查看>>
价值观
查看>>
mongodb命令----批量更改文档字段名
查看>>
CentOS 简单命令
查看>>
使用 SharedPreferences 分类: Andro...
查看>>
TLA+(待续...)
查看>>
题解: [GXOI/GZOI2019]与或和
查看>>
MacOS copy图标shell脚本
查看>>
国外常见互联网盈利创新模式
查看>>