I tested TEdgeBrowser in RAD Studio 10.4.2 Sydney. Dropping the component onto a Form in C++Builder and then calling:
EdgeBrowser1->Navigate("https://www.stackoverflow.com/");
This results in an error on my development machine:
Failed to find an installed WebView2 runtime or non-stable Microsoft Edge installation.
I have placed WebView2Loader.dll (from C:\Program Files (x86)\Embarcadero\Studio\21.0\Redist\win32\) into the project's executable folder, so that could not have been the cause of the error.
After that, I installed Edge Canary, and then it started working without errors.
However, if I compile the same project in Release configuration, and then run on another system which only has a stable installation of the Microsoft Edge browser and doesn't have Edge Canary installed, it all works.
But, if I run the same Release build on my build system, it fails to load (probably because of the same reason as the Debug build - it can't find the Canary installation).
I tested TMS's TAdvWebBrowser component, which doesn't have this requirement, and it works on both systems without installing Edge Canary. But I'd prefer to use TEdgeBrowser instead, to avoid an unnecessary dependency on a third party component.
What is the reason for this odd behavior for TEdgeBrowser, and does the same happen in RAD Studio 11 Alexandria? Can this be avoided so it works with a stable Edge installation on both systems?
EDIT: I later discovered that there is this property:
EdgeBrowser1->BrowserExecutableFolder = "C:\\Program Files (x86)\\Microsoft\\EdgeCore\\101.0.1210.53";
With that, all works. But, according to the documentation (Using TEdgeBrowser Component and Changes to the TWebBrowser Component), it should automatically locate the current version of the WebView2 control on the system. It does this on one system, but not on the development system.
TEdgeBrowser requires WebView2 Runtime in order to operate. More details on MS Edge Documentation website.
WebView2Loader.dll should be loadable by your application, in the same folder, known path or registered in path environment variable. Latest version is available on NuGet. Nupkg is a zip archive. Look in build\native\ folder.
TEdgeBrowser.BrowserExecutableFolder should point to WebView2 runtime folder in case of fixed version.
Fixed version distribution, placed inside your application folder seems the preferred way on your scenario.
MS claims that evergreen version will be distributed by default in next Windows versions.
Related
Submenu File -> New contains only "Other..." and "Customize" items.
How to correct this?
My OS is Windows 10.0.17763.107.
Old version is 10.2 with same problem.
Installed new version 10.4.2, in process of installation of Delphi Community, I have error at Roboto Font downloading:
[403] Forbidden
I pinged this address of Getit found in the registry: https://getit-104.embarcadero.com
It is not responding! Ok, changing to getit.embarcadero.com, the result is negative.
It seems that your Delphi installation hasn't finished properly. Either it was interrupted or Licence manager didn't manage to verify your Community licence properly.
You could try fixing your licence using Licence Manager that you can find inside Delphi folder. If my memory serves me correctly it is located withing BIN subfolder (don't have access to development machine at the moment to verify).
But if the installation proces itself is getting interrupted you might want to download ISO installation instead of Online installation. When installing latest version of Delphi I had to use ISO installation since Web installation kept loosing connection. I suspect my AV Software (ESET Internet Security) with integrated firewall might be the cause.
I'm running WebView2 in my Delphi 11.1 application.
On my dev machine (Win 11), it works normally. It works on test PC1(Win 10), but when I try running it on the other PC (also Win 10) it doesn't load the page.
All PCs have Microsoft Edge WebView2 Runtime (ver. 99.0.1150.39)
Is there any list of DLLs needed, or can someone provide one.
Not every Windows installation comes pre-loaded with the WebView2Loader.dll required for WebView2 Runtime. You will need to distribute the file with your application. The WebView2 Runtime must be included in the main project directory distributed with the source code.
There are two different ways to distribute WebView2 Runtime with your application.
Fixed Version - Package a fixed version of WebView2Loader.dll to be distributed with your application. Download here.
Evergreen - Package the Evergreen Bootstraper to automatically update the required binaries, or package the Evergreen Standalone Installer to be invoked with the installer/updater for offline use-cases. Download here.
The quickest solution would be to add a fixed version of WebView2Loader.dll to the Delphi project directory.
A more detailed description by Microsoft is available for reference to better understand distributing applications with WebView2 Runtime.
I have been working with TEdgeBrowser/WebView2 and an installed version of the Edge Beta/Canary browser version as the "runtime" which seems to work fine. However for production rollout we would greatly prefer to ship the fixed version of the runtime from within our application directory.
I have been attempting to use the following:
MyEdgeBrowser.BrowserExecutableFolder := ExtractFileDir(Application.ExeName) + '\WebView2Runtime';
Within the above referenced path I have the msedgewebview2.exe with the full installation of the fixed version runtime and all supporting files & folders. This is the file that I downloaded and extracted:
Microsoft.WebView2.FixedVersionRuntime.98.0.1108.62.x86.cab
Here's an image of what it looks like when extracted:
I have attempted to place the WebView2Loader.dll in my app directory, in the WebView2Runtime folder, and even in the WebView2Runtime\win-x86\native folder, always as a subfolder of my application directory.
I've tried the 11/20/2021 version of WebView2Loader.dll that Embarcadero distributes with the GetIt package manager, as well as the latest and greatest versions distributed by Microsoft via the NuGet package manager.
The CreateWebView call always fails.
Has anyone successfully got the fixed version runtime to work with Delphi & the WebView2Loader.dll? Are there version specific issues? What folder structure is required?
Thanks.
UPDATE: One crappy workaround that I found was to install a dev or canary version of Edge, then copy all of the files from the "C:\Program Files(x86)\Microsoft\Edge Beta" folder into my app folder, uninstall Edge Beta/Canary, then point the BrowserExecutableFolder to the "Edge Beta\Application<version #>" folder. This is the first time I've seen a "fixed version runtime" function without an Edge or Canary install.
I had started the project in 64-bit mode but for internal reasons had to switch to 32-bit mode. Unfortunately I had not switched back to the 32-bit version of WebView2Loader.dll, but was using the 32-bit version of the runtime.
Once I switched to the 32-bit version of WebView2Loader.dll the TEdgeBrowser was able to work with just the fixed version runtime, no further installation required.
we trying to use WebView2 without WebView2 Runtime (because of it´s 100 MB size and distributing it to clients).
It was tested on 2 PC´s. Both of them have same version of Edge.
On PC1 WebView2 is not working whithout WV2 Runtime, on PC2 is working fine.
Do you have please any clue where can be a problem, why on PC1 is not WebView2 working? (PC1 is used for programming, PC2 no).
Thank you
You can use a fixed Version of WebView2 and by this make sure that your programm works on every PC even if they dont have the runtime installed.
Here you can download the fixed version you prefer:
https://developer.microsoft.com/de-de/microsoft-edge/webview2/
After you downloaded it you need to decompress the file into a folder of your choice.
You can do this with the command-line command:
expand {path to the package} -F:* {path to the destination folder}
Now you should have a folder with an executable runtime for WebView2. With the following code you can say where the path of this "executable folder" is.
var webViewEnvironment = await Microsoft.Web.WebView2.Core.CoreWebView2Environment.CreateAsync("Path of the executable folder"), ("Path where you want the Cache to be saved")));
await webView2.EnsureCoreWebView2Async(webViewEnvironment);
With this you don't need to install the WebView2 Runtime
The runtime is required for WebView2 (with the special exception that insider builds of Edge will provide it). So the answer is that you cannot use WebView2 without the WebView2 Runtime.
To run any WebView2 based applications pre-requisite is to have WebView2 Runtime available on the host machine.
There are two possibilities of running a WebView2 based application
So for your question
Do you have please any clue where can be a problem, why on PC1 is not
WebView2 working? (PC1 is used for programming, PC2 no).
There could be a possibility that Evergreen WebView2 Runtime would already be present on host system (Where app runs).
Also related to availability of Evergreen WebView2 runtime -
In June 2022, Microsoft announced that it would make the WebView2
runtime available to all Windows 10 devices running at least April
2018 updates.
So if you have Windows 10 with 2018 updates or Windows 11 you would be having evergreen WebView2 runtime present.
Advice:
To be sure that your application runs on systems not having Evergreen WebView2 runtime already installed
supply fixed runtime along with your applications as extra payload.
Use webview2 installer during the application start after checking WebView2 runtime availability ( would require elevated privileges )
Having a hard time attempting to run an example how to use TEdgeBrowser component on Windows 10.
Using the latest RAD Studio 10.4.1 (27.0.38860.1461)
The example is located under this path:
c:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\Object Pascal\VCL\WebBrowser\Edge\
Attempting to start results in "Failed to initialise Edge browser control".
What I tried:
Installed the latest stable Edge version (88.0.705.68 (Official build) (64-bit))
Downloaded and installed the runtime from
https://developer.microsoft.com/en-us/microsoft-edge/webview2/
Downloaded this:
https://www.nuget.org/packages/Microsoft.Web.WebView2/1.0.705.50
Extracted WebView2Loader.dll and placed into the same folder where the compiled executable of the above demo resides
The documentation on:
http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_TEdgeBrowser_Component_and_Changes_to_the_TWebBrowser_Component
Seems to be out of date and refers to old 0.9.430 version. I have actually previously used Edge Canary release with that version of WebView2Loader.dll before and that has worked, but the stable version of Edge Chromium was released in the meanwhile, assuming there were breaking API changes.
So, is it even possible to use TEdgeBrowser with Edge Chromium at this point because from all that I've tried it seems pretty hopeless? To me it looks like it is hard-coded against 0.9.430 and RAD Studio 10.4.1 wasn't updated. Is there a workaround of any sort?
for solving this copy "WebView2Loader.dll" to your output path
TEdgeBrowser requires WebView2 Runtime in order to operate. More details on MS Edge Documentation website.
WebView2Loader.dll should be loadable by your application, in the same folder, known path or registered in path environement variable. Latest version is available on NuGet. Nupkg is a zip archive. Look in build\native\ folder.
TEdgeBrowser.BrowserExecutableFolder should point to WebView2 runtime folder in case of fixed version.
MS claims that evergreen version will be distributed by default in next Windows versions.