TsgcWebView2 브라우저 컨트롤

최신의 완전한 기능을 갖춘 Microsoft Edge WebView2(Chromium) 브라우저를 Delphi VCL 애플리케이션 안에 임베드하세요. 폼에 비주얼 컴포넌트를 놓고, 원하는 URL로 이동하고, JavaScript를 실행하고, 쿠키와 다운로드를 관리하세요. 모두 네이티브 Delphi 또는 C++ Builder 코드로 가능해요.

TsgcWebView2

Microsoft Edge WebView2(Chromium)를 감싼 비주얼 VCL 컴포넌트예요. Parent와 Align을 설정하고 DefaultURL을 페이지로 지정하면, 앱에 임베드된 진짜 브라우저가 생겨요. 필요할 때는 COM 인터페이스에 완전히 접근할 수도 있어요.

컴포넌트 클래스

TsgcWebView2

플랫폼

Windows 전용

에디션

Standard / Professional / Enterprise

컴포넌트를 놓고 탐색하세요

폼에 TsgcWebView2를 놓고 Parent와 Align을 설정하고 DefaultURL을 페이지로 지정한 다음, Navigate를 호출하고 ExecuteScript로 JavaScript를 실행하고 OnNavigationCompleted에 반응하세요.

uses
  sgcWebView2;

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

  // 런타임에 탐색
  WebView2.Navigate('https://www.esegece.com');
end;

// JavaScript를 비동기로 실행(결과는 OnScriptExecuted에서)
procedure TForm1.Button1Click(Sender: TObject);
begin
  WebView2.ExecuteScript('document.title');
end;

// 페이지 로딩이 끝나면 반응
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";

// 런타임에 탐색
WebView2->Navigate("https://www.esegece.com");

// JavaScript를 비동기로 실행(결과는 OnScriptExecuted에서)
WebView2->ExecuteScript("document.title");

// OnNavigationCompleted 핸들러
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";

// 런타임에 탐색
webView2.Navigate("https://www.esegece.com");

// JavaScript를 비동기로 실행(결과는 OnScriptExecuted에서)
webView2.ExecuteScript("document.title");

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

내부 구성

WebView2의 전체 기능 영역을 네이티브 Delphi 속성, 메서드, 이벤트로 노출하며, 아직 래핑되지 않은 기능을 위해 ICoreWebView2 COM에 직접 접근할 수 있어요.

탐색

NavigateNavigateToString은 URL이나 메모리 내 HTML을 로드하고, GoBack / GoForward는 기록을 이동하며, Reload / Stop은 로딩을 제어하고, NavigateWithPostData는 사용자 지정 메서드, 본문, 헤더로 요청을 보내요.

JavaScript

ExecuteScript(비동기, 결과는 OnScriptExecuted에서)나 JSON 반환값을 위한 ExecuteScriptSync로 스크립트를 실행하세요. AddInitScript는 페이지가 로드될 때마다 코드를 주입하고, PostWebMessageAsJson / PostWebMessageAsString은 페이지와 통신하며 응답은 OnWebMessageReceived로 받아요.

쿠키 관리

읽기 전용 CookieManagerGetCookies, AddOrUpdateCookie, DeleteCookie, DeleteAllCookies를 노출하여 Delphi 코드에서 모든 호스트의 쿠키를 읽고, 설정하고, 지울 수 있어요.

다운로드

OnDownloadStarting, OnDownloadProgress, OnDownloadCompleted로 파일 다운로드를 처음부터 끝까지 가로채고 추적하세요. 취소하거나, 대상 경로를 변경하거나, 자체 UI에 진행 상황을 표시할 수 있어요.

설정 & 구성

임베드된 브라우저를 Settings(ScriptEnabled, DevToolsEnabled, ContextMenuEnabled)로 조정하고, ZoomFactor를 설정하고, UserDataFolder로 상태를 격리하고, BrowserExecutableFolder로 고정 버전 런타임을 지정하세요.

고급

PrintToPdf / ShowPrintUI로 페이지를 저장하고, CapturePreviewToFile로 스크린샷을 찍고, SetVirtualHostNameToFolderMapping으로 로컬 콘텐츠를 제공하고, OpenDevToolsWindow로 Edge DevTools를 열고, 오디오를 음소거하고, 기본 인증 및 서버 인증서 이벤트를 처리하세요.

Microsoft Edge WebView2 Runtime과 실행 파일 옆에 배치된 WebView2Loader.dll이 필요해요. Windows 전용, Delphi 7부터 Delphi 13까지 지원해요.

사양 & 참고 자료

이 컴포넌트가 임베드하는 엔진의 공인된 원문 자료예요.

문서 & 데모

컴포넌트 레퍼런스로 바로 이동하고, 바로 실행 가능한 데모 프로젝트를 받고, 평가판을 다운로드하세요.

온라인 도움말 — TsgcWebView2 이 컴포넌트의 전체 속성, 메서드, 이벤트 레퍼런스예요.
데모 프로젝트 — Demos\WebView2 바로 실행 가능한 예제 프로젝트예요. sgcWebSockets 패키지에 포함돼 있어요 — 아래에서 평가판을 다운로드하세요.
사용자 매뉴얼 (PDF) 라이브러리의 모든 컴포넌트를 다루는 종합 매뉴얼이에요.

앱에 브라우저를 임베드할 준비가 되셨나요?

무료 평가판을 다운로드하고 Delphi 애플리케이션에 최신 Edge/Chromium 브라우저를 임베드하세요.