BlogDatabases & integration

The PowerBuilder WebBrowser Control: Embedding Modern Web Content with WebView2

You can put a real, modern browser inside a PowerBuilder window — a dashboard, an OAuth login page, a map, a payment flow — and talk to it both ways from PowerScript. Since PowerBuilder 2022 R2 the WebBrowser control runs on Microsoft Edge WebView2 instead of the older CEF engine. Here is what it does, why it matters, and the one deployment detail that trips teams up.

Aug 2026

PowerBuilder can host a real, modern browser inside a native window — and since PowerBuilder 2022 R2 that browser is Microsoft Edge WebView2, the same Chromium engine current Edge uses. The WebBrowser control lets you embed a dashboard, a mapping widget, an OAuth login page or a hosted payment flow directly in your application, and pass data between the page and PowerScript both ways. For a long-running desktop app, that is one of the cleanest routes to modern UI without a rewrite.

What the WebBrowser control is

The WebBrowser control is a standard PowerBuilder control you drop on a window. It first appeared in PowerBuilder 2019 R3 using the Chromium Embedded Framework (CEF). In PowerBuilder 2022 R2 the underlying engine changed from CEF to Microsoft Edge WebView2, and it has been refined in the releases since, including 2025 R2. The practical effect of the WebView2 move: pages render exactly as they do in current Edge, and you inherit Chromium's modern standards support instead of a frozen older build.

EraEngineFrom
Legacy web controlChromium Embedded Framework (CEF)PB 2019 R3
CurrentMicrosoft Edge WebView2 (Chromium)PB 2022 R2 →

What you can do with it

WebView2 gave the control a fuller API. The parts you will actually use:

  • Navigate and load content. Point it at a URL, or use NavigateToString to load HTML you generate in PowerScript — handy for rich, styled output without a round trip to a server.
  • Two-way messaging with the page. PostJsonWebMessage and PostStringWebMessage push data to the page asynchronously; the WebMessageReceived event hands you what the page sends back. EvaluateJavascript runs script and returns the result.
  • Call PowerScript from JavaScript. Define a PowerBuilder user event with a single string parameter and a string return, and trigger it from the page's JavaScript. That is the bridge that makes hybrid features feel native.
  • Downloads and printing. Manage downloads with OpenDefaultDownloadDialog / CloseDefaultDownloadDialog and the downloading events, and print pages to PDF (PdfPrintFinished).
  • Richer events. Alongside the adjusted classics (AddressChange, NavigationStart), WebView2 added events such as NavigationCompleted, DOMContentLoaded, ContentLoading, HistoryChanged and AcceleratorKeyPressed (so you can respond to keys like F5).

Why it matters for a production application

The WebBrowser control is quietly one of the most useful modernization tools in current PowerBuilder, because it lets you add web-era capability to a desktop app one screen at a time:

  1. Modern login and SSO. OAuth2 / OpenID Connect flows expect a real browser. Hosting the provider's login page in WebView2 lets a PowerBuilder app authenticate against Microsoft Entra ID, Google or Okta the way a web app would — the same shift that makes OAuth2 email from PowerBuilder possible.
  2. Embed what already exists on the web. Dashboards, BI tiles, maps, document viewers, hosted payment pages — drop them in rather than reimplementing them in PowerScript.
  3. Incremental UI modernization. A single window can host a modern web component while the rest of the app stays exactly as it is. That is the phased, reversible path we favour over a full rewrite.

The one deployment detail teams miss

WebView2 needs the Microsoft Edge WebView2 Runtime on the end-user machine. You choose how it gets there:

  • Evergreen— shares the machine's Edge WebView2 runtime and auto-updates with it. Smallest footprint, and already present on most current Windows 10 / 11 installs.
  • Fixed Version — you ship a specific, pinned runtime with your application (the PBWebView2 folder). Larger download, but predictable: the browser engine can only change when you decide to ship a new one. The right choice for locked-down or offline environments.

Teams that skip this step see the control work perfectly on their own developer machines (which have Edge) and fail on a clean user machine that does not. Decide Evergreen vs Fixed Version deliberately, and test on a machine without Edge preinstalled.

Frequently asked

What engine does the PowerBuilder WebBrowser control use?

Since PowerBuilder 2022 R2, the WebBrowser control is built on Microsoft Edge WebView2 (Chromium). Earlier releases (from 2019 R3) used the Chromium Embedded Framework (CEF). WebView2 renders modern HTML, CSS and JavaScript the same way current Edge does.

Can PowerScript and the web page talk to each other?

Yes, in both directions. PowerScript sends messages to the page with PostJsonWebMessage or PostStringWebMessage and runs script with EvaluateJavascript; the page sends data back through the WebMessageReceived event. You can also define a PowerBuilder user event (one string parameter, string return) and trigger it from JavaScript.

Do end-user machines need anything installed for WebView2?

They need the Microsoft Edge WebView2 Runtime. You can deploy it two ways: Evergreen, which shares and auto-updates with the machine's Edge runtime, or Fixed Version, where you ship a pinned runtime with your application (the PBWebView2 folder). Evergreen is already present on most current Windows 10/11 machines.

We use the older CEF WebBrowser. What changes when we move to WebView2?

The control keeps the same role but the engine, deployment and some event signatures change. Several events gained additional arguments (AddressChange, NavigationStart, EvaluateJavascriptFinished and others), new events were added (NavigationCompleted, DOMContentLoaded, WebMessageReceived, and more), and deployment switches from the CEF files to the WebView2 Runtime. Budget a short pass to review any JavaScript interop and event handlers.

PowerBuilder notes, now and then

New writing on upgrades, databases and modernization — a few times a month, nothing more.