Jump to content
Incus J

TWebBrowser Edge Engine Unavailable

Recommended Posts

I'm unsure how to get FMX TWebBrowser to use the Edge engine instead of the older IE engine.


I've set its WindowsEngine property to EdgeOnly (Delphi 11).  But I'm seeing a runtime error "Edge browser engine unavailable".


Edge is installed.  I think in the past a .dll file was required (?)  I'm not sure whether this is still the case.  After a Google search I looked in Delphi's Redist folder - but can't see anything that looks promising there.


(On a vaguely related note - is there a way to z-order web controls in FMX?  I'd like to place some controls so that they partially overlap TWebBrowser - appear on top of the web content - but they get clipped.)

Share this post

Link to post

No I hadn't - now installed, thank you!


After dropping WebView2Loader.dll into the app folder, the error message has changed to "Failed to create instance of Edge browser engine"

(The DLL file is version 1.0.664.37).  That suggests the Edge engine is available though.  It is failing here:


procedure TWinNativeWebBrowser.InitializeWebView;
  // Create the environment
  var hr := CreateCoreWebView2EnvironmentWithOptions(PChar(BrowserExecutableFolder), PChar(UserDataFolder), nil,
    Callback<HResult, ICoreWebView2Environment>.CreateAs<ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler>(
  if not ProcessHResult(hr) then
    FBrowserControlState := TBrowserControlState.Failed;


BrowserExecutableFolder and UserDataFolder both appear to be empty - so I need to check whether that is significant.  

ProcessHResult(hr) is returning False for a hr value of -2147024894.

Edited by Incus J

Share this post

Link to post

I think I'm slowly beginning to get a glimmer of understanding - it's slightly more complex than I anticipated.  As well as the EdgeView2 SDK, I've also downloaded and expanded Microsoft's Fixed-Version-Runtime of WebView2, and placed the resulting folder(s) inside my app folder.  So I think I now have all the ingredients.


TWebBrowser will need to know where this Fixed-Version-Runtime folder is.  How do I set a path to this in FMX TWebBrowser?  There is the BrowserExecutableFolder property which I suspect is for this purpose.  It is defined in the FMX.WebBrowser.Win unit:

TEdgeBrowserHelper = class helper for TWinNativeWebBrowser
property BrowserExecutableFolder: string read GetBrowserExecutableFolder write SetBrowserExecutableFolder;

But I've yet to discover exactly how this helper attaches to TWebBrowser itself - BrowserExecutableFolder is not a property exposed in the Object Inspector.  Presumably the private field FWeb references.


Do I somehow need to cast my TWebBrowser instance to a TWinNativeWebBrowser at runtime in order to set this property?  All of this seems private - the types are declared in the unit implementation section.  I must be expected to access this some other way.


How do I ensure the BrowserExecutableFolder property is set to the correct path prior to TWebBrowser attempting to initialise its view?

Edited by Incus J

Share this post

Link to post

The way of deployment you have selected (local, non-updating files) is not the most common.


I'd recommend to spend the five minutes to read about the different deployment options here:

Distribute a WebView2 app and the WebView2 Runtime - Microsoft Edge Development | Microsoft Docs

(Strongly recommended to read the full page)


For setting the path you have placed the files in, you can use CreateCoreebView2EnvironmentWithOptions(..), but you may also use simple environment variables (see link).


As as third way, there already appear to be handy wrappers like the one you have found, but unfortunately, they haven't even written documentation for the VCL version that already exists since 10.4


  • Thanks 1

Share this post

Link to post

Thank you - I'm currently reading.


Yes, I'm using Delphi's built in FMX TWebBrowser control - which has a WindowsEngine property to select the Edge engine at design time.  I just haven't figured out how to get it to work at runtime.


It is interesting that the VCL TEdgeBrowser control exposes the BrowserExecutableFolder property in the Object Inspector at design time.  But FMX TWebBrowser does not.  I wonder whether that is an intended or unintended omission?

Share this post

Link to post

I think I've got it working by installing the Evergreen-Standalone version of WebView2.  So it could simply be that the FMX TWebBrowser doesn't support the Fixed-Version of WebView2 currently.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now