I use TChromium. I assign AWebPageAsString which is a static HTML page with a gray background color.
FBrowser := TChromium.Create(pnlHolder);
FBrowser.Visible := false;
FBrowser.Parent := TWinControl(pnlHolder);
FBrowser.Align := alClient;
FBrowser.OnBeforeBrowse := BrowserBeforeBrowse;
FBrowser.HandleNeeded;
FBrowser.FontOptions.RemoteFontsDisabled := true;
FBrowser.Browser.MainFrame.LoadString(AWebPageAsString, 'navigate:webpage');
When I start the application it is displayed first with white background and empty content and then my page gets displayed with gray background and actual content.
Is there a way to avoid this ? Maybe have a default background color ?
Quite a late answer, I know, but it’s at least an interesting topic. To change default browser’s background color you can use a custom stylesheet. It sounds good, but it has one big weakness – when you navigate to a page that has e.g. no stylesheet defined, your custom one will be applied. But if you know that you’ll browse e.g. only your pages in a certain style, it might be even advantage, since then you can leave the style definitions defined in that default custom style.
So to create a browser with a black background (using the style described below) you can use this code:
The
CSSBase64constant used in the above code is the following stylesheetencoded to Base64: