Jump to content
John R.

Are you using the Edge browser control in production and which one ?

Recommended Posts

I'm targeting Windows 8+ 64-bit with Delphi 11 and was wondering if anyone is using the Edge browser control in production and which one you are using ?

I've spotted the following 4 options:

  • TEdgeBrowser which is part of Delphi 11 installation. It doesn't seem to provide support for custom options such as --disable-web-security to load local files
  • TMSFNCWebBrowser from TMS Software. It doesn't seem to handle --disable-web-security either
  • WebView4Delphi from Salvador Díaz Fau which supports that option, but needs a few tricks to work properly: use a timer for initialization and listen to parent form's MOVE messages to resize properly. This looks a bit weird compared to other components but not a show stopper
  • CEF4Delphi also from Salvador Díaz Fau which I've discarded as being far too large to be distributed with my application

It looks like only WebView4Delphi could work for my use case as it is the only one supporting --disable-web-security and I was wondering if anyone had feedback about using these in production or if you have any other recommendations?

  • Like 1

Share this post


Link to post

We are using the built-in TEdgeBrowser which is sufficient for our needs.

 

I am guilty of taking the quick & dirty way out of Edge blocking local files by default. In one of our projects where we needed it, I simply have:

  Win32Check( SetEnvironmentVariable(
	'WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS',
	'--allow-file-access-from-files'
  ) );

right in the DPR file. Above it is some kind of //TODO: Patch Vcl.Edge.pas so this is no longer necessary.

 

Overall, I'm rather happy with the Edge Browser. We are using it to play videos, display and annotate PDFs, display web content and using rich HTML content editors like SunEditor.

  • Like 2
  • Thanks 1

Share this post


Link to post
21 hours ago, Der schöne Günther said:

We are using the built-in TEdgeBrowser which is sufficient for our needs. 

Thank you for your feedback. Did you receive support requests from people who didn't have Edge installed on their computer ? I haven't tested how the application would behave in such a case and I suspect that it would error on startup due to the use of initialization code.

21 hours ago, Der schöne Günther said:

I am guilty of taking the quick & dirty way out of Edge blocking local files by default.

This doesn't feel "optimal" indeed. I hope that a future Delphi update will offer a better way to achieve this.

Share this post


Link to post

I think Embarcaderos wrapper does not throw any exceptions or displays error messages if it doesn't find the runtime, but I recall seeing an event that lets you check if loading was successful or not.

 

Whether Edge is installed or not does not matter. You have to ship the WebView2 runtime. It is available as a standalone installer. It took me a few minutes to understand how to use TEdgeBrowser (or TWebBrowser), that the runtime must be installed and your Delphi app will need a "WebView2Loader.dll", but after that, I never had to tweak it again.

 

We started shipping it even when TEdgeBrowser/WebView2 was still in preview.

  • Like 1

Share this post


Link to post

We're using it but I wrote a custom wrapper because the one that comes with Delphi is not sufficient. One thing to keep in mind is that Edge is somewhat of a moving target. An update late last year changed how they process query strings on local file paths and completely broke how we were using it and since we use the evergreen, we had to scramble to get out an update to restore the functionality.

  • Thanks 1

Share this post


Link to post
15 hours ago, Brandon Staggs said:

An update late last year changed how they process query strings on local file paths and completely broke how we were using it and since we use the evergreen, we had to scramble to get out an update to restore the functionality

Interesting. Thank you for the heads up.

Is that the issue that you are referring to? https://github.com/MicrosoftEdge/WebView2Feedback/issues/3032

Share this post


Link to post
On 1/27/2023 at 3:34 PM, Der schöne Günther said:

I think Embarcaderos wrapper does not throw any exceptions or displays error messages if it doesn't find the runtime, but I recall seeing an event that lets you check if loading was successful or not.

 

Whether Edge is installed or not does not matter. You have to ship the WebView2 runtime. It is available as a standalone installer. It took me a few minutes to understand how to use TEdgeBrowser (or TWebBrowser), that the runtime must be installed and your Delphi app will need a "WebView2Loader.dll", but after that, I never had to tweak it again.

 

We started shipping it even when TEdgeBrowser/WebView2 was still in preview.

I did today my first baby steps, thanks to your post I finally got my browser working with it (it stayed just white all the time for no reason)
From here i downloaded both runtimes (x86/x64) and did not find the file you mentioned on my system (WebView2Loader.dll)
After searching about that specific needed file, I found out that I do need the WebView2 SDK... but from where?
Finally I ended up here, I clicked on Versions and selected the latest stable (in my case from today it is/was 1.0.1518.46) and clicked on the right side on Download package.
That file is a renamed Zip archive, so I renamed it and extracted everything in a seperate folder.
Inside \runtimes\win-x64\native\ or or \runtimes\win-x86\native\ you will find that file, copy your needed variant x86/x64 next to your compiler project and now no more white screen, app is working.

I hope that helps if someone else want to have the new technology working which by default isnt.

Cheers

Share this post


Link to post

So I've finally selected WebVew4Delphi from Salvador Díaz Fau which is amazing!

It includes many (all?) options to control the WebView's behavior (including allowing local files), is easy to use, fast and well maintained.

Highly recommended!

  • Thanks 1

Share this post


Link to post

I use WebView4Delphi as well. Recently I needed to manipulate a web site to navigate to, select a report, run it then download the report as a csv file. WebView4Delphi had all the needed control. I have never done web development, so it took several days and multiple Stack Overflow posts to get it to work but it has been running flawlessly for weeks now, downloading every half hour.

  • Thanks 1

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

×