Incus J 10 Posted September 15, 2021 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
Uwe Raabe 2057 Posted September 15, 2021 Did you install EdgeView2 SDK from GetIt? 1 Share this post Link to post
Incus J 10 Posted September 15, 2021 (edited) 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; begin ... // Create the environment var hr := CreateCoreWebView2EnvironmentWithOptions(PChar(BrowserExecutableFolder), PChar(UserDataFolder), nil, Callback<HResult, ICoreWebView2Environment>.CreateAs<ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler>( CreateEnvironmentCompleted)); if not ProcessHResult(hr) then begin FBrowserControlState := TBrowserControlState.Failed; DoCreateWebViewCompleted(False); end; end; 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 September 15, 2021 by Incus J Share this post Link to post
Incus J 10 Posted September 15, 2021 (edited) 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 September 15, 2021 by Incus J Share this post Link to post
Der schöne Günther 316 Posted September 15, 2021 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 https://docwiki.embarcadero.com/Libraries/en/Vcl.Edge.TEdgeBrowserHelper.BrowserExecutableFolder 1 Share this post Link to post
Incus J 10 Posted September 15, 2021 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
Incus J 10 Posted September 16, 2021 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
Der schöne Günther 316 Posted September 16, 2021 I never had the use case for the fixed version - Can you get it working in the VCL? Share this post Link to post
ChrisChuah 0 Posted November 3, 2023 hi I am also having this error whereby Microsoft Edge WebView2 Runtime is installed as shown in Programs and Features but Delphi 11.1 will show an exception as shown in the pic please advise regards chris Share this post Link to post
Der schöne Günther 316 Posted November 3, 2023 What have you done, besides installing the runtime? Did you place the WebView2Loader.dll in your application folder? 1 Share this post Link to post
ChrisChuah 0 Posted November 3, 2023 hi, i am using the Twebbrowser component to load a page which i can see it from microsoft edge and chrome but it was not able to be displayed on the TWebbrowser. Any ideas on how to debug it. i think its still using IE but i am trying to use EdgeIfAvailable but Edge engine is not found if i set the EdgeOnly option where can i find the webview2loader.dll? i downloaded the Evergreen standalone as well as the Fixed version. Expanded the Fixed version but cant find this file regards chris Share this post Link to post
ChrisChuah 0 Posted November 3, 2023 hi i managed to find it. must download the EdgeView2 SDK from Getit. From there get the webview2load.dll and copy it to my app directory. thanks chris Share this post Link to post
ChrisChuah 0 Posted November 4, 2023 (edited) Hi I have another question. For Windows x86 and x64, we will need to copy the webview2load.dll to the app directory. How about linux? what are the files that i need to copy or attach to my app directory? The windows webview2load.dll is found in C:\Program Files (x86)\Embarcadero\Studio\22.0\Redist\win64 for 64bit deployment and C:\Program Files (x86)\Embarcadero\Studio\22.0\Redist\win32 for 32bit deployment. Do i attached the entire C:\Program Files (x86)\Embarcadero\Studio\22.0\Redist\linux64 directory files when i deploy for linux when using TWebBrowser in Linux? please advise regards chris Edited November 4, 2023 by ChrisChuah Share this post Link to post
Der schöne Günther 316 Posted November 6, 2023 WebView2 is not available for Linux Linux support · Issue #645 · MicrosoftEdge/WebView2Feedback (github.com) Share this post Link to post
ChrisChuah 0 Posted November 6, 2023 Hi Has anyone tried out this CEF4Delphi https://github.com/salvadordf/CEF4Delphi It seems it can embed chromium based browser into Delphi App and support for Linux Please advise regards chris Share this post Link to post
Der schöne Günther 316 Posted November 6, 2023 12 minutes ago, ChrisChuah said: Has anyone tried out this CEF4Delphi I don't want to be a dick, but entering "CEF4Delphi" into the search box 🔍 in the upper right corner might reveal the answer Share this post Link to post
salvadordf 32 Posted November 6, 2023 4 hours ago, ChrisChuah said: Hi Has anyone tried out this CEF4Delphi https://github.com/salvadordf/CEF4Delphi It seems it can embed chromium based browser into Delphi App and support for Linux Please advise regards chris Yes. CEF4Delphi works on Windows, Linux and macOS. There are some unresolved issues in Linux but it works : https://github.com/salvadordf/CEF4Delphi/issues?q=is%3Aissue+is%3Aopen+label%3ALinux Share this post Link to post
ChrisChuah 0 Posted November 7, 2023 Hi Thank you. Will try it use it on Linux. Regards chris Share this post Link to post