Stay organized with collections
Save and categorize content based on your preferences.
ConsoleMessage
open class ConsoleMessage
Public class representing a JavaScript console message from WebCore. This could be a issued by a call to one of the console
logging functions (e.g. console.log('...')
) or a JavaScript error on the page. To receive notifications of these messages, override the WebChromeClient.onConsoleMessage(ConsoleMessage)
function.
Summary
Public constructors
Public methods
lineNumber
open fun lineNumber(): Int
message
open fun message(): String!
sourceId
open fun sourceId(): String!
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ConsoleMessage\n\nAdded in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nConsoleMessage\n==============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/webkit/ConsoleMessage \"View this page in Java\") \n\n```\nopen class ConsoleMessage\n```\n\n|---|------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.webkit.ConsoleMessage](#) |\n\nPublic class representing a JavaScript console message from WebCore. This could be a issued by a call to one of the `console` logging functions (e.g. `console.log('...')`) or a JavaScript error on the page. To receive notifications of these messages, override the [WebChromeClient.onConsoleMessage(ConsoleMessage)](/reference/kotlin/android/webkit/WebChromeClient#onConsoleMessage(android.webkit.ConsoleMessage)) function.\n\nSummary\n-------\n\n| Nested classes ||\n|---|-------------------------------------------------------------------------------------|\n| | [MessageLevel](/reference/kotlin/android/webkit/ConsoleMessage.MessageLevel) \u003cbr /\u003e |\n\n| Public constructors ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [ConsoleMessage](#ConsoleMessage(kotlin.String,%20kotlin.String,%20kotlin.Int,%20android.webkit.ConsoleMessage.MessageLevel))`(`message:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `sourceId:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `lineNumber:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `msgLevel:` `[ConsoleMessage.MessageLevel](/reference/kotlin/android/webkit/ConsoleMessage.MessageLevel)!`)` \u003cbr /\u003e |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------------|--------------------------------------------|\n| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [lineNumber](#lineNumber())`()` \u003cbr /\u003e |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [message](#message())`()` \u003cbr /\u003e |\n| open [ConsoleMessage.MessageLevel](/reference/kotlin/android/webkit/ConsoleMessage.MessageLevel)! | [messageLevel](#messageLevel())`()` \u003cbr /\u003e |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [sourceId](#sourceId())`()` \u003cbr /\u003e |\n\nPublic constructors\n-------------------\n\n### ConsoleMessage\n\nAdded in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nConsoleMessage(\n message: String!, \n sourceId: String!, \n lineNumber: Int, \n msgLevel: ConsoleMessage.MessageLevel!)\n```\n\nPublic methods\n--------------\n\n### lineNumber\n\nAdded in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun lineNumber(): Int\n``` \n\n### message\n\nAdded in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun message(): String!\n``` \n\n### messageLevel\n\nAdded in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun messageLevel(): ConsoleMessage.MessageLevel!\n``` \n\n### sourceId\n\nAdded in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun sourceId(): String!\n```"]]