TTMSFNCWebBrowser + WhastApp + macOS


I need to create a form window in my application where the user can access WhatsApp web.

I used TTMSFNCWebBrowser which on Windows works perfectly, however, on macOS when accessing the page “” WhatsApp displays the message that it only works on Safari 10 or higher (on my Mac the version is installed 14.0.1).

Does anyone have any suggestions to resolve this?

I already tried to install Chrome and leave it as the default browser but it didn't work.


Can you try with the following code:


procedure TForm1.FormCreate(Sender: TObject);
  w: WKWebView;
  w := TWKWebView.Wrap(TMSFNCWebBrowser1.NativeBrowser);
  if Assigned(w) then
    w.setCustomUserAgent(NSStrEx('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/601.6.17 (KHTML, like Gecko) Version/9.1.1 Safari/601.6.17'));

Please note that there might be additional issue rising when using on an embedded browser.

I tried to use this code but my WkWebView does not have the setCustomuserAgent().

  1. Remove MacApi.WebKit
  2. Add MacApi.AppKit & MacApi.ObjectiveC
  3. Add the following declaration to your form
  WKWebViewClass = interface(NSViewClass)

  WKWebView = interface(NSView)
    procedure setCustomUserAgent(customUserAgent: NSString); cdecl;
    function customUserAgent: NSString; cdecl;

  TWKWebView = class(TOCGenericImport<WKWebViewClass, WKWebView>)

It compiled but the same problem occurred:

Can you try with this agent instead:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8

It worked. :-)

Thank you.

1 Like

Thanks for confirming