110,896
社区成员
发帖
与我相关
我的任务
分享
public void InitBrowser()
{
var setting = new CefSettings
{
Locale = "zh-CN",
//CachePath = "CHBrowser/BrowserCache",
AcceptLanguageList = "zh-CN,zh;q=0.8",
LocalesDirPath = "CHBrowser/localeDir",
LogFile = "CHBrowser/LogData",
PersistSessionCookies = true,
UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36",
UserDataPath = "CHBrowser/userData"
};
setting.CefCommandLineArgs.Add("disable-gpu", "1");
CefSharpSettings.LegacyJavascriptBindingEnabled = true;
///初始化
Cef.Initialize(setting);
WebBrowser = new ChromiumWebBrowser("xxxxxx");
WebBrowser.RegisterJsObject("PortSIP", portSIP, new BindingOptions() { CamelCaseJavascriptNames = false });
WebBrowser.Dock = DockStyle.Fill;
WebBrowser.Dock = DockStyle.Fill;
this.Controls.Add(WebBrowser);
WebBrowser.MenuHandler = new MenuHandler();
setting.CefCommandLineArgs.Add("no-proxy-server", "1");
WebBrowser.FrameLoadEnd += Web_FrameLoadEnd;
WebBrowser.DragHandler = new DragHandler();
}