Jump to content
Sign in to follow this  
Darian Miller

New project with embedded browser

Recommended Posts

I'm starting a new Windows desktop application project (VCL or FMX not yet decided) and one of the functionality requirements is a built-in web browser.  Is CE4 the way to go these days?  https://github.com/salvadordf/CEF4Delphi   It's been a long while since I last integrated a browser into a Delphi app and would appreciate any pointers.

 

Functionality includes navigating to saved links and saving HTML source/images of visited pages.

 

Thanks,


Darian

Share this post


Link to post

A while ago I was looking for something that's cross-platform (Windows and macOS) so decided to check out CE4. For me, it was extremely difficult to work with, if the goal is to use it for automation.

 

I ended up using TWebBrowser in FMX and wrote a bunch of helper methods for both platforms, one of the most critical being:

// macOS
class function THTMLHelper.GetBrowserDocument(const ABrowser: TObject): DOMDocument;
var
  LWebView: WebView;
begin
  Result := nil;
  if Supports(ABrowser, WebView, LWebView) then
    Result := LWebView.mainFrame.DOMDocument;
end;

// Windows
class function THTMLHelper.GetBrowserDocument(const ABrowser: TObject): IHTMLDocument3;
var
  LBrowser: IWebBrowser;
begin
  if Supports(ABrowser, IWebBrowser, LBrowser) then
    Supports(LBrowser.Document, IHTMLDocument3, Result);
end;

 

  • Like 1
  • Thanks 1

Share this post


Link to post

Thanks for sharing - my understanding is that the FMXBrowser is independent of the framework.

 

@Dave NottageWould you share all your enhancements or do you host it somewhere? Github? I think it would be much appreciated

Share this post


Link to post
3 hours ago, Rollo62 said:

Thanks for sharing, did you also get it working with the mobile frameworks ?

I haven't had the need to, however I might take a look at it

 

1 hour ago, baeckerg said:

Would you share all your enhancements or do you host it somewhere?

I'll work on sharing the parts that I can share.

Share this post


Link to post
37 minutes ago, Dave Nottage said:

I haven't had the need to, however I might take a look at it

That would be great.

This is something I assume that is done internally by TMS WebCore, but from my understanding what I asked them, this is a internal WebBrowser, not opened for the normal use, but seems only for internal processing.
So that answer took me away from testing and purchasing this product,, but a reliable bridge between Delphi and browser with all modern JS features is a big thing IMHO, and could even take over some parts of the growing node.js ecosystem a little bit.

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
Sign in to follow this  

×