When I issue a
Chromium.Browser.MainFrame.LoadString(HTML,'code_url');
it appears that the OnLoadEnd event sometimes still loads the HTML of my previous LoadString (maybe several frames are being loaded separately).
I am using
if not frame.IsMain then
Exit;
to make sure only the main frame is being considering in OnLoadEnd, but there are occasions in which a CefGetBitmap returns the bitmap of the previously loaded page (HTML).
My question: how do I know OnLoadEnd is triggered while the ChromiumFMX component is already displaying the correct page?
When the HTML is very concise (small), it is loaded extremely rapidly, and the
OnLoadEndevent is triggered before the ChromiumFMX component is updated.To handle ChromiumFMX content, wait until the
OnLoadEndprocedure has finished. This can be achieved, for instance, by waiting for it to complete in a loop.In other code: