• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Types
2
3> **NOTE**
4>
5> - 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.
6>
7> - You can preview how this component looks on a real device, but not in DevEco Studio Previewer.
8
9## WebviewController<sup>9+</sup>
10
11type WebviewController = WebviewController
12
13Defines methods for the web controller.
14
15**System capability**: SystemCapability.Web.Webview.Core
16
17| Type    | Description      |
18| ------ | ---------- |
19| [WebviewController](./arkts-apis-webview-WebviewController.md)  | A **WebviewController** used 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**.|
20
21## OnAdsBlockedCallback<sup>12+</sup>
22
23type OnAdsBlockedCallback = (details: AdsBlockedDetails) => void
24
25Defines a callback invoked when ads are blocked on the web page.
26
27**System capability**: SystemCapability.Web.Webview.Core
28
29**Parameters**
30
31| Name              | Type                                       | Mandatory  | Description                        |
32| -------------------- | ----------------------------------------------- | ---- | -------------------------------- |
33| details | [AdsBlockedDetails](./arkts-basic-components-web-i.md#adsblockeddetails12) | Yes   | Detailed information about the blocked ads when ads are blocked.|
34
35## OnSslErrorEventCallback<sup>12+</sup>
36
37type OnSslErrorEventCallback = (sslErrorEvent: SslErrorEvent) => void
38
39Defines a callback invoked when an SSL error occurs during resource loading.
40
41**System capability**: SystemCapability.Web.Webview.Core
42
43**Parameters**
44
45| Name   | Type  | Mandatory  | Description                 |
46| ------ | ------ | ---- | --------------------- |
47| sslErrorEvent | [SslErrorEvent](./arkts-basic-components-web-i.md#sslerrorevent12)  | Yes| Details about the callback invoked when an SSL error occurs during resource loading.|
48
49## OnContextMenuHideCallback<sup>11+</sup>
50
51type OnContextMenuHideCallback = () => void
52
53Defines a callback invoked when the context menu is hidden.
54
55**System capability**: SystemCapability.Web.Webview.Core
56
57## OnRenderProcessNotRespondingCallback<sup>12+</sup>
58
59type OnRenderProcessNotRespondingCallback = (data : RenderProcessNotRespondingData) => void
60
61Defines a callback invoked when the rendering process does not respond.
62
63**System capability**: SystemCapability.Web.Webview.Core
64
65**Parameters**
66
67| Name   | Type  | Mandatory  | Description                 |
68| ------ | ------ | ---- | --------------------- |
69| data | [RenderProcessNotRespondingData](./arkts-basic-components-web-i.md#renderprocessnotrespondingdata12) | Yes| Detailed information about the unresponsive rendering process.|
70
71## OnRenderProcessRespondingCallback<sup>12+</sup>
72
73type OnRenderProcessRespondingCallback = () => void
74
75Defines a callback invoked when the rendering process transitions back to a normal operating state from an unresponsive state.
76
77**System capability**: SystemCapability.Web.Webview.Core
78
79## OnViewportFitChangedCallback<sup>12+</sup>
80
81type OnViewportFitChangedCallback = (viewportFit: ViewportFit) => void
82
83Defines a callback invoked when the **viewport-fit** configuration in the web page's **\<meta>** tag changes.
84
85**System capability**: SystemCapability.Web.Webview.Core
86
87**Parameters**
88
89| Name   | Type  | Mandatory  | Description                 |
90| ------ | ------ | ---- | --------------------- |
91| viewportFit | [ViewportFit](./arkts-basic-components-web-e.md#viewportfit12) | Yes| Viewport type for **viewport-fit** in the web page **\<meta>** tag.|
92
93## OnNativeEmbedVisibilityChangeCallback<sup>12+</sup>
94
95type OnNativeEmbedVisibilityChangeCallback = (nativeEmbedVisibilityInfo: NativeEmbedVisibilityInfo) => void
96
97Defines a callback invoked when the visibility of a same-layer tag changes.
98
99**System capability**: SystemCapability.Web.Webview.Core
100
101**Parameters**
102
103| Name   | Type  | Mandatory  | Description                 |
104| ------ | ------ | ---- | --------------------- |
105| nativeEmbedVisibilityInfo | [NativeEmbedVisibilityInfo](./arkts-basic-components-web-i.md#nativeembedvisibilityinfo12)  | Yes| Visibility information about the same-layer tag.|
106
107## OnFullScreenEnterCallback<sup>12+</sup>
108
109type OnFullScreenEnterCallback = (event: FullScreenEnterEvent) => void
110
111Defines a callback invoked when the **Web** component enters full screen mode.
112
113**System capability**: SystemCapability.Web.Webview.Core
114
115**Parameters**
116
117| Name   | Type  | Mandatory  | Description                 |
118| ------ | ------ | ---- | --------------------- |
119| event | [FullScreenEnterEvent](./arkts-basic-components-web-i.md#fullscreenenterevent12)  | Yes| Callback event for the **Web** component to enter full screen mode.|
120
121## OnFirstMeaningfulPaintCallback<sup>12+</sup>
122
123type OnFirstMeaningfulPaintCallback = (firstMeaningfulPaint: [FirstMeaningfulPaint](./arkts-basic-components-web-i.md#firstmeaningfulpaint12)) => void
124
125Defines a callback invoked when the first meaningful paint occurs on the page.
126
127**System capability**: SystemCapability.Web.Webview.Core
128
129**Parameters**
130
131| Name   | Type  | Mandatory  | Description                 |
132| ------ | ------ | ---- | --------------------- |
133| firstMeaningfulPaint | [FirstMeaningfulPaint](./arkts-basic-components-web-i.md#firstmeaningfulpaint12) | Yes| Information about the first meaningful paint.|
134
135## OnLargestContentfulPaintCallback<sup>12+</sup>
136
137type OnLargestContentfulPaintCallback = (largestContentfulPaint: [LargestContentfulPaint](./arkts-basic-components-web-i.md#largestcontentfulpaint12
138)) => void
139
140Defines a callback invoked when the largest content paint occurs on the web page.
141
142**System capability**: SystemCapability.Web.Webview.Core
143
144**Parameters**
145
146| Name   | Type  | Mandatory  | Description                 |
147| ------ | ------ | ---- | --------------------- |
148| largestContentfulPaint | [LargestContentfulPaint](./arkts-basic-components-web-i.md#largestcontentfulpaint12) | Yes| Information about the largest content paint.|
149
150## OnNavigationEntryCommittedCallback<sup>11+</sup>
151
152type OnNavigationEntryCommittedCallback = (loadCommittedDetails: [LoadCommittedDetails](./arkts-basic-components-web-i.md#loadcommitteddetails11)) => void
153
154Defines a callback invoked when a navigation entry is submitted.
155
156**System capability**: SystemCapability.Web.Webview.Core
157
158**Parameters**
159
160| Name   | Type  | Mandatory  | Description                 |
161| ------ | ------ | ---- | --------------------- |
162| loadCommittedDetails | [LoadCommittedDetails](./arkts-basic-components-web-i.md#loadcommitteddetails11)  | Yes| Detailed information about the web page that has been submitted for redirection.|
163
164## OnSafeBrowsingCheckResultCallback<sup>11+</sup>
165
166type OnSafeBrowsingCheckResultCallback = (threatType: ThreatType) => void
167
168Defines a callback invoked by a website safe browsing check.
169
170**System capability**: SystemCapability.Web.Webview.Core
171
172**Parameters**
173
174| Name   | Type  | Mandatory  | Description                 |
175| ------ | ------ | ---- | --------------------- |
176| threatType | [ThreatType](./arkts-basic-components-web-e.md#threattype11)  | Yes| Website threat type. |
177
178## OnIntelligentTrackingPreventionCallback<sup>12+</sup>
179
180type OnIntelligentTrackingPreventionCallback = (details: IntelligentTrackingPreventionDetails) => void
181
182Defines a callback invoked when the tracker cookie is intercepted.
183
184**System capability**: SystemCapability.Web.Webview.Core
185
186**Parameters**
187
188| Name   | Type  | Mandatory  | Description                 |
189| ------ | ------ | ---- | --------------------- |
190| details | [IntelligentTrackingPreventionDetails](./arkts-basic-components-web-i.md#intelligenttrackingpreventiondetails12)  | Yes| Detailed information about intelligent tracking prevention.|
191
192## OnOverrideUrlLoadingCallback<sup>12+</sup>
193
194type OnOverrideUrlLoadingCallback = (webResourceRequest: WebResourceRequest) => boolean
195
196Defines a callback for **onOverrideUrlLoading**.
197
198**System capability**: SystemCapability.Web.Webview.Core
199
200**Parameters**
201
202| Name             | Type   | Mandatory  |  Description|
203| ------------------ | ------- | ---- | ------------- |
204| webResourceRequest   |   [WebResourceRequest](./arkts-basic-components-web-WebResourceRequest.md)   | Yes  | Information about the URL request.|
205
206**Return value**
207
208| Type     | Description                      |
209| ------- | ------------------------ |
210| boolean | Whether the loading is blocked. **true** is returned if the loading is blocked; otherwise, **false** is returned.|
211
212## WebKeyboardCallback<sup>12+</sup>
213
214type WebKeyboardCallback = (keyboardCallbackInfo: WebKeyboardCallbackInfo) => WebKeyboardOptions
215
216Defines 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.
217
218**System capability**: SystemCapability.Web.Webview.Core
219
220**Parameters**
221
222| Name          | Type  | Mandatory  | Description              |
223| ------------- | ------ | ---- | ------------------ |
224| keyboardCallbackInfo    | [WebKeyboardCallbackInfo](./arkts-basic-components-web-i.md#webkeyboardcallbackinfo12) | Yes   | Input parameter of the callback used to intercept the soft keyboard initiated from editable elements on a web page, including [WebKeyboardController](./arkts-basic-components-web-WebKeyboardController.md) and editable element attributes. |
225
226**Return value**
227
228| Type              | Description                                                        |
229| ------------------ | ------------------------------------------------------------ |
230| [WebKeyboardOptions](./arkts-basic-components-web-i.md#webkeyboardoptions12) | [WebKeyboardOptions](./arkts-basic-components-web-i.md#webkeyboardoptions12) instance, which is used to determine which type of soft keyboard to start by the ArkWeb kernel.|
231
232## OnOverrideErrorPageCallback<sup>20+</sup>
233
234type OnOverrideErrorPageCallback = (errorPageEvent: OnErrorReceiveEvent) => string
235
236Defines a callback of **onOverrideErrorPage**. This callback is triggered when a web page fails to be loaded.
237
238**System capability**: SystemCapability.Web.Webview.Core
239
240**Parameters**
241
242| Name            | Type     | Mandatory  | Description                                      |
243| -------------- | ---- | ---- | ---------------------------------------- |
244| errorPageEvent | [OnErrorReceiveEvent](./arkts-basic-components-web-i.md#onerrorreceiveevent12) | Yes| Information returned when an error occurs during web page loading.     |
245
246**Return value**
247
248| Type     | Description                      |
249| ------- | ------------------------ |
250| string | Base64-encoded HTML text content.|
251
252## MouseInfoCallback<sup>20+<sup>
253
254type MouseInfoCallback = (event: NativeEmbedMouseInfo) => void
255
256Defines a callback triggered when a same-layer tag is clicked using the mouse or touchpad.
257
258**System capability**: SystemCapability.Web.Webview.Core
259
260**Parameters**
261
262| Name| Type| Mandatory| Description|
263|--------|------|------|------|
264| event | [NativeEmbedMouseInfo](./arkts-basic-components-web-i.md#nativeembedmouseinfo20) | Yes| Detailed information about clicking or touching and holding a same-layer tag using the mouse or touchpad.|
265
266**Example**
267
268For details about the sample code, see [onNativeEmbedMouseEvent](./arkts-basic-components-web-events.md#onnativeembedmouseevent20).
269