TsgcWebView2 Browser Control

Embed a modern, full-featured Microsoft Edge WebView2 (Chromium) browser inside your Delphi VCL applications. Drop the visual component on a form, navigate to any URL, run JavaScript, manage cookies and downloads, all from native Delphi or C++ Builder code.

TsgcWebView2

A visual VCL component that wraps Microsoft Edge WebView2 (Chromium). Set Parent and Align, point DefaultURL at a page, and you have a real browser embedded in your app, with full COM-interface access when you need it.

Component class

TsgcWebView2

Platforms

Windows only

Edition

Standard / Professional / Enterprise

Drop the component, navigate

Drop a TsgcWebView2 on a form, set Parent and Align, point DefaultURL at a page, then call Navigate, run JavaScript with ExecuteScript and react to OnNavigationCompleted.

uses
  sgcWebView2;

var
  WebView2: TsgcWebView2;
begin
  WebView2 := TsgcWebView2.Create(Self);
  WebView2.Parent := Self;
  WebView2.Align := alClient;
  WebView2.DefaultURL := 'https://www.example.com';

  // navigate at runtime
  WebView2.Navigate('https://www.esegece.com');
end;

// run JavaScript asynchronously (result in OnScriptExecuted)
procedure TForm1.Button1Click(Sender: TObject);
begin
  WebView2.ExecuteScript('document.title');
end;

// react when the page has finished loading
procedure TForm1.WebView2NavigationCompleted(Sender: TObject;
  aIsSuccess: Boolean; aWebErrorStatus: Integer);
begin
  if aIsSuccess then
    Caption := WebView2.DocumentTitle;
end;
// uses: sgcWebView2
TsgcWebView2 *WebView2 = new TsgcWebView2(this);
WebView2->Parent = this;
WebView2->Align = alClient;
WebView2->DefaultURL = "https://www.example.com";

// navigate at runtime
WebView2->Navigate("https://www.esegece.com");

// run JavaScript asynchronously (result in OnScriptExecuted)
WebView2->ExecuteScript("document.title");

// OnNavigationCompleted handler
void __fastcall TForm1::WebView2NavigationCompleted(TObject *Sender,
  bool aIsSuccess, int aWebErrorStatus)
{
  if (aIsSuccess)
    Caption = WebView2->DocumentTitle;
}
// namespace: esegece.sgcWebSockets
var webView2 = new TsgcWebView2();
webView2.Parent = this;
webView2.Align = DockStyle.Fill;
webView2.DefaultURL = "https://www.example.com";

// navigate at runtime
webView2.Navigate("https://www.esegece.com");

// run JavaScript asynchronously (result in OnScriptExecuted)
webView2.ExecuteScript("document.title");

// OnNavigationCompleted handler
webView2.OnNavigationCompleted += (sender, e) =>
{
  if (e.IsSuccess)
    Text = webView2.DocumentTitle;
};

What's inside

A full WebView2 surface area exposed as native Delphi properties, methods and events, with direct ICoreWebView2 COM access for anything that is not yet wrapped.

Navigate and NavigateToString load URLs or in-memory HTML, GoBack / GoForward walk history, Reload / Stop control loading, and NavigateWithPostData issues a custom method, body and headers.

JavaScript

Run scripts with ExecuteScript (async, result in OnScriptExecuted) or ExecuteScriptSync for a JSON return value. AddInitScript injects code on every page load, and PostWebMessageAsJson / PostWebMessageAsString talk to the page, with replies in OnWebMessageReceived.

The read-only CookieManager exposes GetCookies, AddOrUpdateCookie, DeleteCookie and DeleteAllCookies so you can read, set and clear cookies for any host from Delphi code.

Downloads

Intercept and track file downloads end to end with OnDownloadStarting, OnDownloadProgress and OnDownloadCompleted. Cancel, redirect the target path, or report progress in your own UI.

Settings & configuration

Tune the embedded browser through Settings (ScriptEnabled, DevToolsEnabled, ContextMenuEnabled), set ZoomFactor, isolate state with UserDataFolder, and pin a fixed-version runtime via BrowserExecutableFolder.

Advanced

Save pages with PrintToPdf / ShowPrintUI, grab a screenshot with CapturePreviewToFile, serve local content via SetVirtualHostNameToFolderMapping, open Edge DevTools with OpenDevToolsWindow, mute audio, and handle basic-auth and server-certificate events.

Requires the Microsoft Edge WebView2 Runtime and WebView2Loader.dll placed next to your executable. Windows only, Delphi 7 through Delphi 13.

Specifications & references

Authoritative sources for the engine this component embeds.

Documentation & Demos

Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.

Online Help — TsgcWebView2 Full property, method and event reference for this component.
Demo Project — Demos\WebView2 Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
User Manual (PDF) Comprehensive manual covering every component in the library.

Ready to Embed a Browser in Your App?

Download the free trial and embed a modern Edge/Chromium browser in your Delphi applications.