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

2026-08-25 浏览 (1)

Types

NOTE

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

  • The sample effect is subject to the actual device.

WebviewController9+

type WebviewController = WebviewController

Defines methods for the web controller.

System capability: SystemCapability.Web.Webview.Core

TypeDescription
WebviewControllerUsed to control the behavior of the Web component. A WebviewController object can control only one Web component. Methods (except static methods) on the WebviewController can be called only after the Web component is bound to the WebviewController.

OnAdsBlockedCallback12+

type OnAdsBlockedCallback = (details: AdsBlockedDetails) => void

Defines a callback invoked when ads are blocked on the web page.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
detailsAdsBlockedDetailsYesDetailed information about the blocked ads when ads are blocked.

OnSslErrorEventCallback12+

type OnSslErrorEventCallback = (sslErrorEvent: SslErrorEvent) => void

Defines a callback invoked when an SSL error occurs during resource loading.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
sslErrorEventSslErrorEventYesDetails about the callback invoked when an SSL error occurs during resource loading.

OnVerifyPinCallback22+

type OnVerifyPinCallback = (verifyPinEvent: VerifyPinEvent) => void

Callback triggered to notify the user of PIN authentication.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
verifyPinEventVerifyPinEventYesDetails of the callback triggered to notify the user of PIN authentication.

OnContextMenuHideCallback11+

type OnContextMenuHideCallback = () => void

Defines a callback invoked when the context menu is hidden.

System capability: SystemCapability.Web.Webview.Core

OnRenderProcessNotRespondingCallback12+

type OnRenderProcessNotRespondingCallback = (data : RenderProcessNotRespondingData) => void

Defines a callback invoked when the rendering process does not respond.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
dataRenderProcessNotRespondingDataYesDetailed information about the unresponsive rendering process.

OnRenderProcessRespondingCallback12+

type OnRenderProcessRespondingCallback = () => void

Defines a callback invoked when the rendering process transitions back to a normal operating state from an unresponsive state.

System capability: SystemCapability.Web.Webview.Core

OnViewportFitChangedCallback12+

type OnViewportFitChangedCallback = (viewportFit: ViewportFit) => void

Defines a callback invoked when the viewport-fit configuration in the web page's <meta> tag changes.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
viewportFitViewportFitYesViewport type for viewport-fit in the web page <meta> tag.

OnNativeEmbedVisibilityChangeCallback12+

type OnNativeEmbedVisibilityChangeCallback = (nativeEmbedVisibilityInfo: NativeEmbedVisibilityInfo) => void

Defines a callback invoked when the visibility of a same-layer tag changes.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
nativeEmbedVisibilityInfoNativeEmbedVisibilityInfoYesVisibility information about the same-layer tag.

OnFullScreenEnterCallback12+

type OnFullScreenEnterCallback = (event: FullScreenEnterEvent) => void

Defines a callback invoked when the Web component enters full screen mode.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
eventFullScreenEnterEventYesCallback event for the Web component to enter full screen mode.

OnFirstMeaningfulPaintCallback12+

type OnFirstMeaningfulPaintCallback = (firstMeaningfulPaint: FirstMeaningfulPaint) => void

Defines a callback invoked when the first meaningful paint occurs on the page.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
firstMeaningfulPaintFirstMeaningfulPaintYesInformation about the first meaningful paint.

OnLargestContentfulPaintCallback12+

type OnLargestContentfulPaintCallback = (largestContentfulPaint: LargestContentfulPaint) => void

Defines a callback invoked when the largest content paint occurs on the web page.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
largestContentfulPaintLargestContentfulPaintYesInformation about the largest content paint.

OnNavigationEntryCommittedCallback11+

type OnNavigationEntryCommittedCallback = (loadCommittedDetails: LoadCommittedDetails) => void

Defines a callback invoked when a navigation entry is submitted.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
loadCommittedDetailsLoadCommittedDetailsYesDetailed information about the web page that has been submitted for redirection.

OnSafeBrowsingCheckResultCallback11+

type OnSafeBrowsingCheckResultCallback = (threatType: ThreatType) => void

Defines a callback invoked by a website safe browsing check.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
threatTypeThreatTypeYesWebsite threat type.

OnIntelligentTrackingPreventionCallback12+

type OnIntelligentTrackingPreventionCallback = (details: IntelligentTrackingPreventionDetails) => void

Defines a callback invoked when the tracker cookie is intercepted.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
detailsIntelligentTrackingPreventionDetailsYesDetailed information about intelligent tracking prevention.

OnOverrideUrlLoadingCallback12+

type OnOverrideUrlLoadingCallback = (webResourceRequest: WebResourceRequest) => boolean

Defines a callback for onOverrideUrlLoading.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
webResourceRequestWebResourceRequestYesInformation about the URL request.

Return value

TypeDescription
booleanWhether the loading is blocked. true is returned if the loading is blocked; otherwise, false is returned.

WebKeyboardCallback12+

type WebKeyboardCallback = (keyboardCallbackInfo: WebKeyboardCallbackInfo) => WebKeyboardOptions

Defines a callback to intercept the soft keyboard initiated from editable elements on a web page. This event is typically called when the <input> tag on the web page is clicked.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
keyboardCallbackInfoWebKeyboardCallbackInfoYesInput parameter of the callback used to intercept the soft keyboard initiated from editable elements on a web page, including WebKeyboardController and editable element attributes.

Return value

TypeDescription
WebKeyboardOptionsWebKeyboardOptions instance, which is used to determine which type of soft keyboard to start by the ArkWeb kernel.

OnOverrideErrorPageCallback20+

type OnOverrideErrorPageCallback = (errorPageEvent: OnErrorReceiveEvent) => string

Defines a callback of onOverrideErrorPage. This callback is triggered when a web page fails to be loaded.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
errorPageEventOnErrorReceiveEventYesInformation returned when an error occurs during web page loading.

Return value

TypeDescription
stringBase64-encoded HTML text content.

MouseInfoCallback20+

type MouseInfoCallback = (event: NativeEmbedMouseInfo) => void

Defines a callback triggered when a same-layer tag is clicked using the mouse or touchpad.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
eventNativeEmbedMouseInfoYesDetailed information about clicking or touching and holding a same-layer tag using the mouse or touchpad.

Example

For details about the sample code, see onNativeEmbedMouseEvent.

OnNativeEmbedObjectParamChangeCallback21+

type OnNativeEmbedObjectParamChangeCallback = (event: NativeEmbedParamDataInfo) => void

Defines a callback triggered when the param element embedded in the same-layer rendered object tag is added, modified, or deleted.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
eventNativeEmbedParamDataInfoYesDetailed information about the changes of the param element embedded in the object tag.

Example

For details about the sample code, see onNativeEmbedObjectParamChange.

OnDetectBlankScreenCallback22+

type OnDetectBlankScreenCallback = (event: BlankScreenDetectionEventInfo) => void

Defines a callback triggered when a blank screen is detected.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
eventBlankScreenDetectionEventInfoYesDetailed information when a blank screen is detected.

Example

For details about the sample code, see onDetectedBlankScreen.

OnCameraCaptureStateChangeCallback23+

type OnCameraCaptureStateChangeCallback = (event: CameraCaptureStateChangeInfo) => void;

Defines a callback triggered when the camera state of the page changes.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
eventCameraCaptureStateChangeInfoYesOriginal and new camera state.

OnMicrophoneCaptureStateChangeCallback23+

type OnMicrophoneCaptureStateChangeCallback = (event: MicrophoneCaptureStateChangeInfo) => void;

Defines a callback triggered when the microphone state of the page changes.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
eventMicrophoneCaptureStateChangeInfoYesOriginal and new microphone state.

TextSelectionChangeCallback23+

type TextSelectionChangeCallback = (selectionText: string) => void

Defines a callback triggered when the text selection changes.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
selectionTextstringYesSelected text.

Example

For details about the complete sample code, see onTextSelectionChange.

OnFirstScreenPaintCallback23+

type OnFirstScreenPaintCallback = (firstScreenPaint: FirstScreenPaint) => void

Defines a callback triggered when the first screen paint is complete.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
firstScreenPaintFirstScreenPaintYesDetails about the first screen paint.

Example

For details about the complete sample code, see onFirstScreenPaint.

你可能感兴趣的鸿蒙文章

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/M2BcQUms