salvadordf / WebView4Delphi

WebView4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC for Windows.
https://www.briskbard.com/forum/
MIT License
280 stars 56 forks source link

console.log #32

Closed mxmihai closed 1 year ago

mxmihai commented 1 year ago

Hi, this is a great job you did! Is there a way to capture the console.log in a similar way to CEF4Delphi? Thank you.

salvadordf commented 1 year ago

I don't remember of any way to capture the console messages with the current stable version of the WebView2 API but if you need to send messages between JavaScript and Delphi then use the BrowserHostAppCommunication demo.

If you really need to intercept the console messages you might try the DevTools commands. The "Console" domain has a Runtime.consoleAPICalled event that might be what you need but I've never tried it.

You can track this issue in the official WebView2 Feedback repository : https://github.com/MicrosoftEdge/WebView2Feedback/issues/2982

mxmihai commented 1 year ago

thanks, BrowserHostAppCommunication is exactly what I was looking for.