openharmony 鸿蒙 arkts-apis-webview-JsMessageExt

2026-08-25 浏览 (1)

Class (JsMessageExt)

Implements a JsMessageExt object that is returned after the runJavaScriptExt API is invoked.

NOTE

  • The initial APIs of this module are supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version.

  • The initial APIs of this class are supported since API version 10.

  • The sample effect is subject to the actual device.

getType10+

getType(): JsMessageType

Obtains the type of the data object. For details about the sample code, see runJavaScriptExt.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
JsMessageTypeData type of the result returned after the runJavaScriptExt API is executed.

getString10+

getString(): string

Obtains string-type data of the data object. For details about the sample code, see runJavaScriptExt.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
stringData of the string type.

Error codes

For details about the error codes, see Webview Error Codes.

Error CodeError Message
17100014The type and value of the message do not match.

getNumber10+

getNumber(): number

Obtains number-type data of the data object. For details about the sample code, see runJavaScriptExt.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
numberData of the number type.

Error codes

For details about the error codes, see Webview Error Codes.

Error CodeError Message
17100014The type and value of the message do not match.

getBoolean10+

getBoolean(): boolean

Obtains Boolean-type data of the data object. For details about the sample code, see runJavaScriptExt.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
booleanData of the Boolean type.

Error codes

For details about the error codes, see Webview Error Codes.

Error CodeError Message
17100014The type and value of the message do not match.

getArrayBuffer10+

getArrayBuffer(): ArrayBuffer

Obtains raw binary data of the data object. For details about the sample code, see runJavaScriptExt.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
ArrayBufferRaw binary data.

Error codes

For details about the error codes, see Webview Error Codes.

Error CodeError Message
17100014The type and value of the message do not match.

getArray10+

getArray(): Array<string|number|boolean>

Obtains array-type data of the data object. For details about the sample code, see runJavaScriptExt.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
Array<string |number |boolean>Data of the array type.

Error codes

For details about the error codes, see Webview Error Codes.

Error CodeError Message
17100014The type and value of the message do not match.

getErrorDescription22+

getErrorDescription(): string |null

Obtains the error information about the JavaScript execution. For details about the sample code, see runJavaScriptExt.

System capability: SystemCapability.Web.Webview.Core

Return value

TypeDescription
string |nullIf an exception occurs during JavaScript execution or the return value is of the object type, "Not support type: <{exception\object}>" is returned.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-webview-WebviewController

openharmony 鸿蒙 arkts-apis-webview-t

openharmony 鸿蒙 arkts-apis-webview

openharmony 鸿蒙 capi-arkweb-type-h

openharmony 鸿蒙 arkts-basic-components-web-FullScreenExitHandler

openharmony 鸿蒙 arkts-apis-webview-WebDownloadManager

openharmony 鸿蒙 arkts-basic-components-web-VerifyPinHandler

openharmony 鸿蒙 capi-web-arkweb-webmessage8h

openharmony 鸿蒙 arkts-apis-webview-NativeMediaPlayerHandler

openharmony 鸿蒙 capi-web-arkweb-proxymethodwithresult

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/tMfpzPkT