onConsoleMessage method

  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()])
void onConsoleMessage(
  1. ConsoleMessage consoleMessage
)

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

Parameters - Officially Supported Platforms/Implementations:

  • consoleMessage: all platforms

Use the PlatformInAppBrowserEvents.isMethodSupported method to check if this method 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(),
  ],
)
void onConsoleMessage(ConsoleMessage consoleMessage) {}