Page 1 of 1

LoadingStateChange not behaving as expected

PostPosted: Mon Jul 19, 2021 5:43 am
by vitorroriz
Dear community,

The following behavior was experienced in both libcef versions 3.3440.1805 (Chromium 68) and 91.1.21 (Chromium 91.0.4472).

I want that a given browser instance is just visible after <target_url> has finished loading, for that I'm using OnLoadingStateChange to trigger an internal message that will result on setting browser visible. However, I can, sometimes, for a very short time (in the order of 100's ms) still see the former loaded URL in the browser. To set visibility true, I'm checking that isLoading == false, and I'm verifying that GetURL() == <target_url>.

While searching about it, I've found an old thread on CEF C# repo that seems to be related (https://github.com/cefsharp/CefSharp/issues/1406), however I'm not sure if it applies.

Would someone have some suggestion?

Thank you!

Re: LoadingStateChange not behaving as expected

PostPosted: Tue Jul 20, 2021 7:58 pm
by HarmlessDave
LoadingStateChange says that the main page HTML has been fetched, but only that. Any includes such as images, CSS, scripts, frames, iframes may still be loading. Script code may be running that will add to the page. Some sites might load almost nothing as the main page and do all of the real work through includes and frames or AJAX and the process can take time.

You can get an idea of how complicated a page is by using F12 in Google Chrome and looking at the Network tab.

Re: LoadingStateChange not behaving as expected

PostPosted: Tue Nov 16, 2021 8:51 am
by vitorroriz
Hi @HarmlessDave, I'm really sorry, but I totally missed your message.

I'm aware not all resources are loaded at once and that LoadingStateChange is called several times. The issue here is of other kind, also because, if that was the problem a hack solution like loading about:blank temporarily would fix it, what doesn't happen. The thing is, no matter which event I use (AddressChange or later LoadingStateChange), everytime I set the document visible again, I'll see the previous URL for a short time. It is like if, although URL is already fetched, the action of displaying pages will just start once the page is visible.