Replies: 2 comments 7 replies
-
The three events you can use are:
If you need to execute javascript at a particular readyState then you'll need to use javascript to achieve that See https://github.com/cefsharp/CefSharp/wiki/General-Usage#when-can-i-start-executing-javascript //Wait for the MainFrame to finish loading
browser.FrameLoadStart+= (sender, args) =>
{
//MainFrame has started to load, too early to access the DOM, you can add event listeners for DOMContentLoaded etc.
if(args.Frame.IsMain)
{
const string script = "document.addEventListener('DOMContentLoaded', function(){ alert('DomLoaded'); });";
args.Frame.ExecuteJavaScriptAsync(script);
}
}; You can use something like https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState#readystatechange_as_event_listener_to_insert_or_modify_the_dom_before_domcontentloaded to pick the particular readyState you are after to execute your code. If your just interested in the page load state then picking one of the three events above is the easiest option.
The browser is designed to be |
Beta Was this translation helpful? Give feedback.
-
However I still didn |
Beta Was this translation helpful? Give feedback.
-
I have following function to load webpage. It is waiting for "completed" state of document to return. However in my case "interactive" state (https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState) is enough. How to modify my url load function to wait not for "completed" but just "interactive" loading state?
`public virtual void LoadUrlCore(string url)
{
if (String.IsNullOrEmpty(url)) return;
Beta Was this translation helpful? Give feedback.
All reactions