onConsoleMessage property

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebChromeClient.onConsoleMessage', apiUrl: 'https://developer.android.com/reference/android/webkit/WebChromeClient#onConsoleMessage(android.webkit.ConsoleMessage)'), IOSPlatform(note: 'This event is implemented using JavaScript.'), MacOSPlatform(note: 'This event is implemented using JavaScript.'), WebPlatform(), WindowsPlatform(), LinuxPlatform(note: 'This event is implemented using JavaScript.')])
void Function(T controller, ConsoleMessage consoleMessage)? onConsoleMessage
final

Event fired when the WebView receives a ConsoleMessage.

Officially Supported Platforms/Implementations:

  • Android WebView (Official API - WebChromeClient.onConsoleMessage)
  • iOS WKWebView:
    • This event is implemented using JavaScript.
  • macOS WKWebView:
    • This event is implemented using JavaScript.
  • Web <iframe> but requires same origin
  • Windows WebView2
  • Linux WPE WebKit:
    • This event is implemented using JavaScript.

Parameters - Officially Supported Platforms/Implementations:

  • consoleMessage: all platforms

Use the PlatformWebViewCreationParams.isPropertySupported method to check if this property is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(
      apiName: 'WebChromeClient.onConsoleMessage',
      apiUrl:
          'https://developer.android.com/reference/android/webkit/WebChromeClient#onConsoleMessage(android.webkit.ConsoleMessage)',
    ),
    IOSPlatform(note: 'This event is implemented using JavaScript.'),
    MacOSPlatform(note: 'This event is implemented using JavaScript.'),
    WebPlatform(),
    WindowsPlatform(),
    LinuxPlatform(note: 'This event is implemented using JavaScript.'),
  ],
)
final void Function(T controller, ConsoleMessage consoleMessage)?
onConsoleMessage;