Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.
procedure TForm1.Button1Click(Sender: TObject);
begin
if Chromium1.Initialized then
begin
Chromium1.WasHidden(False);
Chromium1.SendFocusEvent(True);
Chromium1.LoadURL(edUrl.Text);
end
else
begin
Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
Chromium1.DefaultURL := edUrl.Text;
Chromium1.CreateBrowser(nil, '');
end;
end;
procedure TForm1.Chromium1LoadingStateChange(Sender: TObject;
const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean);
begin
if isLoading then
begin
StatusBar1.Panels[1].Text := 'Loading...';
Memo1.Lines.Add('Loading...');
end
else
begin
StatusBar1.Panels[1].Text := 'Finished';
Memo1.Lines.Add('Finished');
end;
end;
///
// Called when the loading state has changed. This callback will be executed
// twice -- once when loading is initiated either programmatically or by user
// action, and once when loading is terminated due to completion, cancellation
// of failure. It will be called before any calls to OnLoadStart and after all
// calls to OnLoadError and/or OnLoadEnd.
///
Perhaps the web page has some JavaScript code that loads more resources after the page has finished loading for the first time.