Jump to content
salvadordf

My new project : WebView4Delphi

Recommended Posts

I just published a new project in GitHub called WebView4Delphi.
WebView4Delphi allows you to embed Chromium based web browsers in your Delphi or Lazarus applications using the WebView2 runtime.
It uses the latest stable version of the WebView2 nuget package 1.0.1054.31.
I used many of the tricks I learned creating CEF4Delphi and you will notice many similarities if you used it.
I still have to write the documentation but you can build the available demos to see it working in VCL, FMX and Lazarus apps.
There are a few things pending like the "windowless mode".
It's being distributed with a simple MIT license so anyone can do whatever s/he wants with it.
 
  • Like 12
  • Thanks 6

Share this post


Link to post

Great.  Thank you.

 

Have you tested going to drive.google.com by any chance?  Google is no longer allowing the custom browser that I last compiled with CEF4.  I have been meaning to recompile to get around the problem.  Google lets me into gmail and they let me download items from drive when the notices come into gmail, but direct use of google drive is blocked.  They detect my CEF4 browser as an old version of "Firefox" now. 

 

 

Share this post


Link to post
6 hours ago, Ann Lynnworth said:

Great.  Thank you.

 

Have you tested going to drive.google.com by any chance?  Google is no longer allowing the custom browser that I last compiled with CEF4.  I have been meaning to recompile to get around the problem.  Google lets me into gmail and they let me download items from drive when the notices come into gmail, but direct use of google drive is blocked.  They detect my CEF4 browser as an old version of "Firefox" now. 

 

 

I haven't checked that.
Sometimes this is just the result of some temporal issue in the Google servers and they fix it but sometimes this a deliberate safety measure from Google against all embedded browsers.
Try using a modern Firefox user agent string.

Edited by salvadordf

Share this post


Link to post

You are right! It was just a matter of passing a more recent useragent string.

    GlobalCEFApp.UserAgent :=  // TCefApplication  with CEF4
      'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0';

 

  • Like 1

Share this post


Link to post

I tried WebView4Delphi, but I could not get it to work.

Yes, I  know - I'm not using the indicated Delphi versions.

I'm stuck with Delphi 6 PE. And WebView4Delphi just doesnt compile.

I tried to tiddle with the source, but I was soon discouraged by the too many differencies between Delphi 6 and Delphi 7.

 

So, may I  ask you if there is any (perhaps older) version of WebView4Delphi, compatible with Delphi 6 ?

Share this post


Link to post
6 hours ago, klaus49 said:

So, may I  ask you if there is any (perhaps older) version of WebView4Delphi, compatible with Delphi 6 ?

I'm sorry but WebView4Delphi requires at least Delphi 7.

If you need to test this component you can also use Lazarus or Delphi Community Edition.
 

Share this post


Link to post

Thank you for your reply.

 

Unfortunately, I'm really stuck to Delphi 6 PE. I'm implementing a (huge) support DLL for another language, and all the stuff is writte, in Delphi 6 PE.

Actually, there are over 1300 support functions available, all fully documented in french and english.

 

I'm trying to add Edge-style support to my DLL. My actual WebBrowser functions are based on TWebBrowser (IE environment), and Window"s future evolutions will make this obsolete.

I looked for WebView5Delphi for this very reason.

 

Do you have any clue for enother (freeware) component supporting Edge, WebView or Chrome, operational under Delphi 6 PE ? This would be very helpfull !

 

Just a few words about myself: I am a 73 year old retired former informatic system engineer, creating open source programs for my own pleasure. Nothing commercial. But this explains why I can't invest in comercial products.

Share this post


Link to post
11 hours ago, klaus49 said:

Do you have any clue for enother (freeware) component supporting Edge, WebView or Chrome, operational under Delphi 6 PE ? This would be very helpfull !

I'm not sure if it supports Delphi 6 but I would also try Wke4Delphi :
https://gitee.com/LangjiApp/Wke4Delphi

 

Share this post


Link to post

Just want to say Thank you for this component. I needed vcl - TWebBrowser replacement for Delphi Rio.. and your component fit right into it. 

 

Thank you again and carry on! 🙂

 

  • Thanks 1

Share this post


Link to post
On 11/5/2022 at 1:20 AM, klaus49 said:

Unfortunately, I'm really stuck to Delphi 6 PE. I'm implementing a (huge) support DLL for another language, and all the stuff is writte, in Delphi 6 PE.

What about using a second DLL? You could write this new DLL with Delphi Community Edition, where you can use newer components. Then you can load this new DLL by your old DLL and just redirect the calls to the new DLL. This way you do not have to upgrade your existing code, but you can use WebView4Delphi though.

  • Like 1

Share this post


Link to post

Hi, I'm having trouble installing webview4delphi under Delphi XE7.

 

I am receiving the following error: 

 

"The program can't start because WebView4DelphiVCLRTL.bpl is missing from your computer. 

Try reinstalling the program to fix this problem."

 

But the file is showing in the listing below: 

 

webview4delphi_xe7_installation_issues.thumb.png.6bb987759a3447064c3924e3358461ff.png

Share this post


Link to post

Build WebView4DelphiVCLRTL.bpl, WebView4DelphiFMXRTL.bpl, WebView4DelphiVCL_designtime.bpl and WebView4DelphiFMX_designtime.bpl individually (in that order) or download the latest WebView4Delphi version from GitHub.

 

I recently fixed a project order issue in the project group file thanks to the information on this thread.

 

This Wiki article has all the details to install WebView4Delphi in Delphi.

Share this post


Link to post
Posted (edited)

Unfortunately, I am still getting the same error message stated in my first post above.  I've also downloaded the latest version, which are dated 3/9/2024. 

 

Please note, each file that I Build, I am first double-clicking on it to select it


WebView4DelphiVCLRTL.bpl, 

when I right-click it, I select Build, when it finishes, I get Done.

 

WebView4DelphiFMXRTL.bpl, 

when I right-click it, I select Build, when it finishes, I get Warnings.

 

WebView4DelphiVCL_designtime.bpl

when I right-click it, I select Build, when it finishes, I get Done.

** this is the file that will not complete when I right-click and select Install.  I get the error message stated earlier. ** 

 

WebView4DelphiFMX_designtime.bpl

when I right-click, I select Build, when it finishes, I get Warnings.

** this file also will not complete when I right-click and select Install.  I get the error message stated earlier. ** 

 

Edited by JohnLM

Share this post


Link to post

The BPL files should be created in $(BDSCOMMONDIR)\Bpl and not in the WebView4Delphi\packages directory.

 

Perhaps the "Package output directory" option is not set to $(BDSCOMMONDIR)\Bpl

 

Open the Tools -> Options... menu option and then select the "Environment options -> Delphi options -> Library" node in the left tree view.

There you can check the "Package output directory" value.

 

If you can't modify that setting try adding the WebView4Delphi\packages directory to the search path.

Share this post


Link to post
Posted (edited)

Your suggestion to change the 'Package output directory' worked.  The components have been added successfully.  Thanks.

 

However, when I try to compile a few of your demos, they fail.  It seems none of the .dcu files are being created and Delphi can't find them at compile time. 

 

below are from your SimpleBroswer demo.  They are in the Uses section with red underlines.  

 

uWVBrowser, uWVWinControl, uWVWindowParent, uWVTypes, uWVConstants, uWVTypeLibrary,
  uWVLibFunctions, uWVLoader, uWVInterfaces, uWVCoreWebView2Args,
  uWVBrowserBase

 

Edited by JohnLM

Share this post


Link to post

Resolved - regarding the .dcu files. 

 

Under the:   options -> Environment Options -> Delphi Options -> Library -> Library Path: 

 

I added the "\WebView4Delphi-main\source\" folder 

 

After this update, the SimpleBrowser compiled and ran. 

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

×