Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ FAQ How do I specify the default type of native renderer that is used by the Bro

The default native renderers that are used for `SWT.NONE`-style Browsers are listed in [Which platforms support the SWT Browser, and which native renderers do they use?](./FAQ_Which_platforms_support_the_SWT_Browser,_and_which_native_renderers_are_available.md). Default is chosen to not require additional software installation and to preserve backward-compatible behavior.

A user can set a property to specify the type of native renderer to use for `SWT.NONE`-style Browsers. Setting this property does not affect Browsers that are created with explicit renderer styles such as `SWT.WEBKIT` or `SWT.CHROMIUM`. The property name is `org.eclipse.swt.browser.DefaultType` and valid values for it currently include `webkit`, `ie` (since 4.3), `chromium` (since 4.17) and `edge` (since 4.19). This property must be set before the first `Browser` instance is created.
A user can set a property to specify the type of native renderer to use for `SWT.NONE`-style Browsers. Setting this property does not affect Browsers that are created with explicit renderer styles such as `SWT.WEBKIT` or `SWT.CHROMIUM`. The property name is `org.eclipse.swt.browser.DefaultType` and valid values for it currently include `webkit`, `ie` (since 4.3), `chromium` (since 4.17 and deprecated since 4.31) and `edge` (since 4.19). This property must be set before the first `Browser` instance is created.

_Note: As of Eclipse/SWT 4.8, Mozilla (`XULRunner`) renderer is no longer supported, the value `mozilla` has no effect._

A user can specify a comma-separated list of native renderers, in order of preference, for the `org.eclipse.swt.browser.DefaultType` value. Values not applicable to a particular platform are ignored. For example, the value of `edge,chromium` will change the default to Edge on Windows and Chromium on other platforms.
A user can specify a comma-separated list of native renderers, in order of preference, for the `org.eclipse.swt.browser.DefaultType` value. Values not applicable to a particular platform are ignored. For example, the value of `ie,webkit` will change the default to Internet Explorer on Windows and Webkit on other platforms.

The best opportunity for a user to set this property is by launching their application with a `-D` VM switch (e.g., add to the end of the `eclipse.ini` file: `-Dorg.eclipse.swt.browser.DefaultType=chromium`).
The best opportunity for a user to set this property is by launching their application with a `-D` VM switch (e.g., add to the end of the `eclipse.ini` file: `-Dorg.eclipse.swt.browser.DefaultType=webkit`).

An alternate approach that an Eclipse application may use is to provide a `BrowserInitializer` implementation that sets this property. This implementation will be invoked when the first Browser instance is about to be created. The steps to do so are:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# FAQ How do I use Edge/IE as the Browser's underlying renderer?

Since Eclipse/SWT 4.35 (2025-03) Edge is used as the default browser in SWT. For older releases, browser instances using Edge could be created with the style `SWT.EDGE` (since 4.19) or setting the Java property `org.eclipse.swt.browser.DefaultType=edge`.

## WebView2 Component Provision

Edge rendering backend uses the WebView2 component, which is based on but distinct from the Edge browser itself. SWT relies on a WebView2 component being available on the current system.
There are different [ways of distribution for the WebView2 component](https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution). On most systems, the component is already available due to the `Evergreen runtime distribution mode` ensuring the availability of an automatically updated version of the library on Windows.

If this is not the case or if other versions of the component shall be used, these options exist:
* A stand-alone runtime installer, either web or offline ([Download the WebView2 Runtime](https://developer.microsoft.com/en-us/microsoft-edge/webview2/#webview-title) from Microsoft).
This runtime will be shared between all applications on the machine and will auto-update itself independent of your application.
* A fixed-version archive with all the necessary files (same link as above).
This is a complete, fixed set of files to be included with your application. Unlike the first option, you have complete freedom in bundling, packaging and updating it.
* Beta, Dev, or Canary version of the Edge browser (<https://www.microsoftedgeinsider.com/en-us/download>).
This option is convenient for testing, but production deployments should use the previous two options.

SWT will automatically locate installed browsers and runtimes (using the `WebView2Loader.dll` provided via the SWT fragment for Windows).
In case you want to use fixed-version binaries or override the automatically chosen version, set the `org.eclipse.swt.browser.EdgeDir` Java property to the directory containing `msedgewebview2.exe`. For example, you can add `-Dorg.eclipse.swt.browser.EdgeDir=PATH_TO_EDGE` with `PATH_TO_EDGE` being the absolute path to an Edge installation as a command-line argument to an SWT application or to the `eclipse.ini` of an Eclipse product.

## WebView2 Data Directory

WebView2 creates a user data directory to store caches and persistent data like cookies and local storage. All WebView2 instances in an application and all instances of the same application share this directory.

The default user directory is customizable and depends on the usage context:
* In a plain SWT application, the default location is `%LOCALAPPDATA%\<AppName>\EBWebView`, where `<AppName>` is defined with `Display.setAppName()`.
* In an Eclipse product, the default location is inside the metadata folder of the workspace, precisely in `.metadata\.plugins\org.eclipse.swt\EBWebView`.
* The location can be customized by specifying it on a per-process basis via the `org.eclipse.swt.browser.EdgeDataDir` Java property.

## WebView2 Timeouts

All operations on a WebView2 component are executed asynchronously, including it's initialization. Under some conditions and in some environments, operations can take rather long, which is why the WebView2 adaptation in SWT uses timeouts to avoid UI blocks.
In case you run into such timeouts and want to increase the timeout value, you can do so via the `org.eclipse.swt.internal.win32.Edge.timeout` property, which accepts a timeout value in milliseconds.

## Fallback to Internet Explorer

Beginning with 4.35, browser instances in Eclipse/SWT application will use Edge by default and need to be created with style `SWT.IE` or via setting the Java property `org.eclipse.swt.browser.DefaultType=ie` to still use the Internet Explorer.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ The SWT Browser is currently available on all supported platforms. Available ren

| Renderer | Platform | Style Flag | Default |
| --------------------- | ---------------- | -------------- | ------- |
| Internet Explorer | Windows | `SWT.IE` | Yes |
| Edge (Chromium-based) | Windows | `SWT.EDGE` | Yes |
| WebKit | macOS, Linux GTK | `SWT.WEBKIT` | Yes |
| Edge (Chromium-based) | Windows | `SWT.EDGE` | No |
| Internet Explorer | Windows | `SWT.IE` | No |
| Chromium | All | `SWT.CHROMIUM` | No |

_Note: As of Eclipse/SWT 4.8, Mozilla (`XULRunner`) renderer is no longer supported, `SWT.MOZILLA` flag is deprecated and has no effect._

_Note: As of Eclipse/SWT 4.35, Edge became the default browser on Windows._

Browser instances created with style `SWT.NONE` will use the default platform renderer according to the table above. The default renderer does not require additional software installation. It is possible to override the default native renderer. See [How do I specify the default type of native renderer that is used by the Browser](./FAQ-How-do-I-specify-the-default-type-of-native-renderer-that-is-used-by-the-Browser).

For additional information on specific renderers, see [How do I explicitly use Chromium as the Browser's underlying renderer](FAQ-How-do-I-explicitly-use-Chromium-as-the-Browser's-underlying-renderer) and [How do I explicitly use Edge as the Browser's underlying renderer](./FAQ-How-do-I-explicitly-use-Edge-as-the-Browser's-underlying-renderer).
2 changes: 1 addition & 1 deletion docs/FAQ/The_Official_Eclipse_FAQs.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Above, we already discussed most of the basic functionality of the org.eclipse.c
* [FAQ How can I track the lifecycle of jobs?](./FAQ_How_can_I_track_the_lifecycle_of_jobs.md "FAQ How can I track the lifecycle of jobs?")
* [FAQ How do I create a repeating background task?](./FAQ_How_do_I_create_a_repeating_background_task.md "FAQ How do I create a repeating background task?")
* [FAQ How do I explicitly use Chromium as the Browser's underlying renderer?](./FAQ-How-do-I-explicitly-use-Chromium-as-the-Browser's-underlying-renderer.md "FAQ How do I explicitly use Chromium as the Browser's underlying renderer?")
* [FAQ How do I explicitly use Edge as the Browser's underlying renderer?](./FAQ-How-do-I-explicitly-use-Edge-as-the-Browser's-underlying-renderer.md "FAQ How do I explicitly use Edge as the Browser's underlying renderer?")
* [FAQ How do I use Edge/IE as the Browser's underlying renderer?](./FAQ_How_do_I_use_Edge-IE_as_the_Browser's_underlying_renderer.md "FAQ How do I use Edge/IE as the Browser's underlying renderer?")
* [FAQ How do I specify the default type of native renderer that is used by the Browser?](./FAQ-How-do-I-specify-the-default-type-of-native-renderer-that-is-used-by-the-Browser.md "FAQ How do I specify the default type of native renderer that is used by the Browser?")
* [FAQ Which GTK version do I need to run SWT?](./FAQ-Which-GTK-version-do-I-need-to-run-SWT.md "FAQ Which GTK version do I need to run SWT?")
* [FAQ Which platforms support the SWT Browser, and which native renderers are available?](./FAQ-Which-platforms-support-the-SWT-Browser,-and-which-native-renderers-are-available.md "FAQ Which platforms support the SWT Browser, and which native renderers are available?")
Expand Down
Loading