private void InitWebControl()
{
WebControl.BrowserSettings = new BrowserSettings
{
ApplicationCache = CefState.Disabled,
};
//_webControl.LoadError += _webControl_LoadError;
//_webControl.ConsoleMessage += _webControl_ConsoleMessage;
//_webControl.FrameLoadStart += _webControl_FrameLoadStart;
WebControl.FrameLoadStart += (sender, args) =>
{
if (WebControl.CanExecuteJavascriptInMainFrame)
{
WebControl.ExecuteScriptAsync(
"var node = document.createElement('style'); node.innerHTML = 'html, body, iframe {overflow:hidden;}'; document.body.appendChild(node);");
}
};
WebControl.IsBrowserInitializedChanged += (sender, args) =>
{
};
WebControl.LoadingStateChanged += (sender, args) =>
{
if (WebControl.CanExecuteJavascriptInMainFrame)
{
WebControl.ExecuteScriptAsync("alert('All Resources Have Loaded');");
}
//Wait for the Page to finish loading
if (args.IsLoading == false)
{
//error
WebControl.ExecuteScriptAsync("alert('All Resources Have Loaded');");
}
};WebControl.FrameLoadEnd += (sender, args) =>
{
//not fired
if (WebControl.CanExecuteJavascriptInMainFrame)
{
WebControl.ExecuteScriptAsync("alert('All Resources Have Loaded');");
}
WebControl.ExecuteScriptAsync("alert('All Resources Have Loaded');");
};