• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# native_interface_arkweb.h
2
3## Overview
4
5Declares APIs used to register objects and execute JavaScript code.
6
7**Library**: libohweb.so
8
9**System capability**: SystemCapability.Web.Webview.Core
10
11**Since**: 11
12
13**Related module**: [Web](capi-web.md)
14
15## Summary
16
17### Functions
18
19| Name| typedef Keyword| Description|
20| -- | -- | -- |
21| [typedef void (\*NativeArkWeb_OnJavaScriptCallback)(const char*)](#nativearkweb_onjavascriptcallback) | NativeArkWeb_OnJavaScriptCallback | Called to return the result after the JavaScript code is executed.|
22| [typedef char* (\*NativeArkWeb_OnJavaScriptProxyCallback)(const char** argv, int32_t argc)](#nativearkweb_onjavascriptproxycallback) | NativeArkWeb_OnJavaScriptProxyCallback | Called when a JavaScript proxy is registered.|
23| [typedef void (\*NativeArkWeb_OnValidCallback)(const char*)](#nativearkweb_onvalidcallback) | NativeArkWeb_OnValidCallback | Called when a **Web** component is valid.|
24| [typedef void (\*NativeArkWeb_OnDestroyCallback)(const char*)](#nativearkweb_ondestroycallback) | NativeArkWeb_OnDestroyCallback | Called when a **Web** component is destroyed.|
25| [typedef void (\*OH_ArkWeb_OnCookieSaveCallback)()](#oh_arkweb_oncookiesavecallback) | OH_ArkWeb_OnCookieSaveCallback | Called when a cookie is saved.<br>**Since**: 20|
26| [typedef ArkWeb_BlanklessInfo](#arkweb_blanklessinfo) | ArkWeb_BlanklessInfo | Prediction information about blankless loading, including the first screen similarity, first screen loading duration, and error code. The application determines whether to enable frame insertion for blankless loading based on the prediction information.|
27| [void OH_NativeArkWeb_RunJavaScript(const char* webTag, const char* jsCode, NativeArkWeb_OnJavaScriptCallback callback)](#oh_nativearkweb_runjavascript) | - | Loads and asynchronously executes a JavaScript code in the current page.|
28| [void OH_NativeArkWeb_RegisterJavaScriptProxy(const char* webTag, const char* objName, const char** methodList,NativeArkWeb_OnJavaScriptProxyCallback* callback, int32_t size, bool needRefresh)](#oh_nativearkweb_registerjavascriptproxy) | - | Displays the list of registered objects and function names.|
29| [void OH_NativeArkWeb_UnregisterJavaScriptProxy(const char* webTag, const char* objName)](#oh_nativearkweb_unregisterjavascriptproxy) | - | Deletes a registered object and its callback.|
30| [void OH_NativeArkWeb_SetJavaScriptProxyValidCallback(const char* webTag, NativeArkWeb_OnValidCallback callback)](#oh_nativearkweb_setjavascriptproxyvalidcallback) | - | Sets a callback used when an object is valid.|
31| [NativeArkWeb_OnValidCallback OH_NativeArkWeb_GetJavaScriptProxyValidCallback(const char* webTag)](#oh_nativearkweb_getjavascriptproxyvalidcallback) | - | Obtains the callback used when a registered object is valid.|
32| [void OH_NativeArkWeb_SetDestroyCallback(const char* webTag, NativeArkWeb_OnDestroyCallback callback)](#oh_nativearkweb_setdestroycallback) | - | Sets a callback used when a component is destroyed.|
33| [NativeArkWeb_OnDestroyCallback OH_NativeArkWeb_GetDestroyCallback(const char* webTag)](#oh_nativearkweb_getdestroycallback) | - | Obtains the callback used when a registered component is destroyed.|
34| [ArkWeb_ErrorCode OH_NativeArkWeb_LoadData(const char* webTag,const char* data,const char* mimeType,const char* encoding,const char* baseUrl,const char* historyUrl)](#oh_nativearkweb_loaddata) | - | Loads data or URLs. This function must be called in the main thread.|
35| [void OH_NativeArkWeb_RegisterAsyncThreadJavaScriptProxy(const char* webTag,const ArkWeb_ProxyObjectWithResult* proxyObject, const char* permission)](#oh_nativearkweb_registerasyncthreadjavascriptproxy) | - | Registers a JavaScript object that contains callback methods, which can have return values. This object will be registered into all frames of the current page, including all iframes, and can be accessed by using the name specified in **ArkWeb_ProxyObjectWithResult**. The object takes effect in JavaScript only after the page is loaded or reloaded next time. Its methods are executed in the worker thread of ArkWeb.|
36| [ArkWeb_ErrorCode OH_ArkWebCookieManager_SaveCookieSync()](#oh_arkwebcookiemanager_savecookiesync) | - | Saves all cookies that can be accessed through the **CookieManager** API to disks. To use this API in a non-UI thread, you need to use **OH_ArkWeb_GetNativeAPI** to initialize the **CookieManager** API.<br>**Since**: 20|
37| [void OH_ArkWebCookieManager_SaveCookieAsync(OH_ArkWeb_OnCookieSaveCallback callback)](#oh_arkwebcookiemanager_savecookieasync) | - | Saves all cookies that can be accessed through the **CookieManager** API to disks. If the **CookieManager** API is not initialized, this API is automatically executed on the UI thread.<br>**Since**: 20|
38| [ArkWeb_BlanklessInfo OH_NativeArkWeb_GetBlanklessInfoWithKey(const char* webTag, const char* key)](#oh_nativearkweb_getblanklessinfowithkey) | - | Obtains the first screen loading prediction information, and starts to generate the loading transition frame. The application determines whether to enable blankless loading based on the information. For details, see [ArkWeb_BlanklessInfo](#arkweb_blanklessinfo). This API must be used together with the [OH_NativeArkWeb_SetBlanklessLoadingWithKey](#oh_nativearkweb_setblanklessloadingwithkey) API and must be called before the page loading API is triggered and after **WebViewController** is bound to the **Web** component.|
39| [ArkWeb_BlanklessErrorCode OH_NativeArkWeb_SetBlanklessLoadingWithKey(const char* webTag, const char* key, bool isStarted)](#oh_nativearkweb_setblanklessloadingwithkey) | - | Sets whether to enable blankless loading. This API must be used together with the [OH_NativeArkWeb_GetBlanklessInfoWithKey](#oh_nativearkweb_getblanklessinfowithkey) API.|
40| [void OH_NativeArkWeb_ClearBlanklessLoadingCache(const char* key[], uint32_t size)](#oh_nativearkweb_clearblanklessloadingcache) | - | Clears the blankless loading cache of the page with a specified key value.|
41| [uint32_t OH_NativeArkWeb_SetBlanklessLoadingCacheCapacity(uint32_t capacity)](#oh_nativearkweb_setblanklessloadingcachecapacity) | - | Sets the persistent cache capacity of the blankless loading solution and returns the value that takes effect. The default cache capacity is 30 MB, and the maximum cache capacity is 100 MB. When this limit is exceeded, transition frames that are not frequently used are eliminated.|
42
43## Function Description
44
45### NativeArkWeb_OnJavaScriptCallback()
46
47```
48typedef void (*NativeArkWeb_OnJavaScriptCallback)(const char*)
49```
50
51**Description**
52
53Called to return the result after the JavaScript code is executed.
54
55**Since**: 11
56
57### NativeArkWeb_OnJavaScriptProxyCallback()
58
59```
60typedef char* (*NativeArkWeb_OnJavaScriptProxyCallback)(const char** argv, int32_t argc)
61```
62
63**Description**
64
65Called when a JavaScript proxy is registered.
66
67**Since**: 11
68
69### NativeArkWeb_OnValidCallback()
70
71```
72typedef void (*NativeArkWeb_OnValidCallback)(const char*)
73```
74
75**Description**
76
77Called when a **Web** component is valid.
78
79**Since**: 11
80
81### NativeArkWeb_OnDestroyCallback()
82
83```
84typedef void (*NativeArkWeb_OnDestroyCallback)(const char*)
85```
86
87**Description**
88
89Called when a **Web** component is destroyed.
90
91**Since**: 11
92
93### OH_ArkWeb_OnCookieSaveCallback()
94
95```
96typedef void (*OH_ArkWeb_OnCookieSaveCallback)()
97```
98
99**Description**
100
101Called when a cookie is saved.
102
103**Since**: 20
104
105### ArkWeb_BlanklessInfo()
106
107## Overview
108
109Prediction information about blankless loading, including the first screen similarity, first screen loading duration, and error code. The application determines whether to enable frame insertion for blankless loading based on the prediction information.
110
111**Since**: 20
112
113### Member Variables
114
115| Name| Description|
116| -- | -- |
117| ArkWeb_BlanklessErrorCode errCode | Error codes of blankless loading. For details, see [ArkWeb_BlanklessErrorCode](./capi-arkweb-error-code-h.md#arkweb_blanklesserrorcode).|
118| double similarity | First screen similarity, which is calculated based on the historical first screen content. The value ranges from 0 to 1.0. 1.0 indicates that the content is the same. A value closer to 1 indicates a higher similarity. This value is lagging, and the similarity of local loading is displayed in the next loading. You are advised not to enable the blankless loading solution when the similarity is low.|
119| int32_t loadingTime | Loading duration estimated based on the historical first screen loading durations, in milliseconds. The value must be greater than 0.|
120
121### OH_NativeArkWeb_RunJavaScript()
122
123```
124void OH_NativeArkWeb_RunJavaScript(const char* webTag, const char* jsCode, NativeArkWeb_OnJavaScriptCallback callback)
125```
126
127**Description**
128
129Loads and asynchronously executes a JavaScript code in the current page.
130
131**System capability**: SystemCapability.Web.Webview.Core
132
133**Since**: 11
134
135
136**Parameters**
137
138| Name| Description|
139| -- | -- |
140| const char* webTag | Name of the **Web** component.|
141| const char* jsCode | A piece of JavaScript code script.|
142| [NativeArkWeb_OnJavaScriptCallback](#nativearkweb_onjavascriptcallback) callback | Callback for notifying the code execution result.|
143
144### OH_NativeArkWeb_RegisterJavaScriptProxy()
145
146```
147void OH_NativeArkWeb_RegisterJavaScriptProxy(const char* webTag, const char* objName, const char** methodList,NativeArkWeb_OnJavaScriptProxyCallback* callback, int32_t size, bool needRefresh)
148```
149
150**Description**
151
152Displays the list of registered objects and function names.
153
154**System capability**: SystemCapability.Web.Webview.Core
155
156**Since**: 11
157
158
159**Parameters**
160
161| Name| Description|
162| -- | -- |
163| const char* webTag | Name of the **Web** component.|
164| const char* objName | Name of the registered object.|
165| const char** methodList | Name of the registered method list.|
166| [NativeArkWeb_OnJavaScriptProxyCallback](#nativearkweb_onjavascriptproxycallback)* callback | Registered callback.|
167| int32_t size | Number of registered callbacks.|
168| bool needRefresh | Whether a page need to be refreshed.|
169
170### OH_NativeArkWeb_UnregisterJavaScriptProxy()
171
172```
173void OH_NativeArkWeb_UnregisterJavaScriptProxy(const char* webTag, const char* objName)
174```
175
176**Description**
177
178Deletes a registered object and its callback.
179
180**System capability**: SystemCapability.Web.Webview.Core
181
182**Since**: 11
183
184
185**Parameters**
186
187| Name| Description|
188| -- | -- |
189| const char* webTag | Name of the **Web** component.|
190| const char* objName | Name of the registered object.|
191
192### OH_NativeArkWeb_SetJavaScriptProxyValidCallback()
193
194```
195void OH_NativeArkWeb_SetJavaScriptProxyValidCallback(const char* webTag, NativeArkWeb_OnValidCallback callback)
196```
197
198**Description**
199
200Sets a callback used when an object is valid.
201
202**System capability**: SystemCapability.Web.Webview.Core
203
204**Since**: 11
205
206
207**Parameters**
208
209| Name| Description|
210| -- | -- |
211| const char* webTag | Name of the **Web** component.|
212| [NativeArkWeb_OnValidCallback](#nativearkweb_onvalidcallback) callback | Callback used when an object is valid.|
213
214### OH_NativeArkWeb_GetJavaScriptProxyValidCallback()
215
216```
217NativeArkWeb_OnValidCallback OH_NativeArkWeb_GetJavaScriptProxyValidCallback(const char* webTag)
218```
219
220**Description**
221
222Obtains the callback used when a registered object is valid.
223
224**System capability**: SystemCapability.Web.Webview.Core
225
226**Since**: 11
227
228
229**Parameters**
230
231| Name| Description|
232| -- | -- |
233| const char* webTag | Name of the **Web** component.|
234
235**Returns**
236
237| Type| Description|
238| -- | -- |
239| [NativeArkWeb_OnValidCallback](#nativearkweb_onvalidcallback) | Callback used when a registered object is valid.|
240
241### OH_NativeArkWeb_SetDestroyCallback()
242
243```
244void OH_NativeArkWeb_SetDestroyCallback(const char* webTag, NativeArkWeb_OnDestroyCallback callback)
245```
246
247**Description**
248
249Sets a callback used when a component is destroyed.
250
251**System capability**: SystemCapability.Web.Webview.Core
252
253**Since**: 11
254
255
256**Parameters**
257
258| Name| Description|
259| -- | -- |
260| const char* webTag | Name of the **Web** component.|
261| [NativeArkWeb_OnDestroyCallback](#nativearkweb_ondestroycallback) callback | Callback used when a component is destroyed.|
262
263### OH_NativeArkWeb_GetDestroyCallback()
264
265```
266NativeArkWeb_OnDestroyCallback OH_NativeArkWeb_GetDestroyCallback(const char* webTag)
267```
268
269**Description**
270
271Obtains the callback used when a registered component is destroyed.
272
273**System capability**: SystemCapability.Web.Webview.Core
274
275**Since**: 11
276
277
278**Parameters**
279
280| Name| Description|
281| -- | -- |
282| const char* webTag | Name of the **Web** component.|
283
284**Returns**
285
286| Type| Description|
287| -- | -- |
288| [NativeArkWeb_OnDestroyCallback](#nativearkweb_ondestroycallback) | Callback used when a registered component is destroyed.|
289
290### OH_NativeArkWeb_LoadData()
291
292```
293ArkWeb_ErrorCode OH_NativeArkWeb_LoadData(const char* webTag,const char* data,const char* mimeType,const char* encoding,const char* baseUrl,const char* historyUrl)
294```
295
296**Description**
297
298Loads data or URLs. This function must be called in the main thread.
299
300**System capability**: SystemCapability.Web.Webview.Core
301
302**Since**: 15
303
304
305**Parameters**
306
307| Name| Description|
308| -- | -- |
309| const char* webTag | Name of the **Web** component.|
310| const char* data | String being base64 or URL encoded, which cannot be empty.|
311| const char* mimeType | Media type, such as **text/html**, which cannot be empty.|
312| const char* encoding | Encoding type, such as **UTF-8**, which cannot be empty.|
313| const char* baseUrl | URL (HTTP/HTTPS/Data), which is assigned by the **Web** component to **window.origin**.|
314| const char* historyUrl | Historical URL. If this parameter is not empty, it can be managed in historical records to implement backward and forward navigation.|
315
316**Returns**
317
318| Type                                                              | Description                                                                                                                                                                                                                                                                                                                        |
319|------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
320| [ArkWeb_ErrorCode](capi-arkweb-error-code-h.md#arkweb_errorcode) | Error codes of **LoadData**.<br>         [ARKWEB_SUCCESS](capi-arkweb-error-code-h.md#arkweb_errorcode): The data is successfully loaded.<br>         [ARKWEB_INVALID_PARAM](capi-arkweb-error-code-h.md#arkweb_errorcode): The mandatory parameter is not specified, the parameter type is incorrect, or the parameter verification fails.<br>         [ARKWEB_INIT_ERROR](capi-arkweb-error-code-h.md#arkweb_errorcode): The initialization failed because no valid **Web** component is found based on the input **webTag**.<br>         [ARKWEB_LIBRARY_OPEN_FAILURE](capi-arkweb-error-code-h.md#arkweb_errorcode): Failed to open the dynamic link library.<br>         [ARKWEB_LIBRARY_SYMBOL_NOT_FOUND](capi-arkweb-error-code-h.md#arkweb_errorcode): The required symbol is not found in the dynamic link library.|
321
322### OH_NativeArkWeb_RegisterAsyncThreadJavaScriptProxy()
323
324```
325void OH_NativeArkWeb_RegisterAsyncThreadJavaScriptProxy(const char* webTag,const ArkWeb_ProxyObjectWithResult* proxyObject, const char* permission)
326```
327
328**Description**
329
330Registers a JavaScript object that contains callback methods, which can have return values. This object will be registered into all frames of the current page, including all iframes, and can be accessed by using the name specified in **ArkWeb_ProxyObjectWithResult**. The object takes effect in JavaScript only after the page is loaded or reloaded next time. Its methods are executed in the worker thread of ArkWeb.
331
332**Since**: 20
333
334
335**Parameters**
336
337| Name                                                | Description|
338|-----------------------------------------------------| -- |
339| const char* webTag                                  | Name of the **Web** component.|
340| const [ArkWeb_ProxyObjectWithResult](capi-web-arkweb-proxyobjectwithresult.md)* proxyObject | Object to be registered.|
341| const char* permission                              |  A JSON string used to configure the object and method levels of the JSBridge permission. This value is empty by default.|
342
343### OH_ArkWebCookieManager_SaveCookieSync()
344
345```
346ArkWeb_ErrorCode OH_ArkWebCookieManager_SaveCookieSync()
347```
348
349**Description**
350
351Saves all cookies that can be accessed through the **CookieManager** API to disks. To use this API in a non-UI thread, you need to use **OH_ArkWeb_GetNativeAPI** to initialize the **CookieManager** API.
352
353**Since**: 20
354
355**Returns**
356
357| Type| Description|
358| -- | -- |
359| [ArkWeb_ErrorCode](capi-arkweb-error-code-h.md#arkweb_errorcode) | Error codes of **SaveCookieSync**.<br> [ARKWEB_SUCCESS](capi-arkweb-error-code-h.md#arkweb_errorcode): The cookie is successfully saved.<br> [ARKWEB_COOKIE_MANAGER_NOT_INITIALIZED](capi-arkweb-error-code-h.md#arkweb_errorcode): This API cannot be invoked in a non-UI thread without initializing the **CookieManager** API. You need to use **OH_ArkWeb_GetNativeAPI** to initialize the **CookieManager** API first.|
360
361### OH_ArkWebCookieManager_SaveCookieAsync()
362
363```
364void OH_ArkWebCookieManager_SaveCookieAsync(OH_ArkWeb_OnCookieSaveCallback callback)
365```
366
367**Description**
368
369Saves all cookies that can be accessed through the **CookieManager** API to disks. If the **CookieManager** API is not initialized, this API is automatically executed on the UI thread.
370
371**Since**: 20
372
373**Parameters**
374
375| Name| Description|
376| -- | -- |
377| [OH_ArkWeb_OnCookieSaveCallback](#oh_arkweb_oncookiesavecallback)* callback | Callback triggered when cookies are saved.|
378### OH_NativeArkWeb_GetBlanklessInfoWithKey()
379
380```
381ArkWeb_BlanklessInfo OH_NativeArkWeb_GetBlanklessInfoWithKey(const char* webTag, const char* key)
382```
383
384**Description**
385
386Obtains the first screen loading prediction information, and starts to generate the loading transition frame. The application determines whether to enable blankless loading based on the information. For details, see [ArkWeb_BlanklessInfo](#arkweb_blanklessinfo). This API must be used together with the [OH_NativeArkWeb_SetBlanklessLoadingWithKey](#oh_nativearkweb_setblanklessloadingwithkey) API and must be called before the page loading API is triggered and after **WebViewController** is bound to the **Web** component.
387
388> **NOTE**
389>
390> - Currently, this feature is supported only on mobile phones.
391> - The default size of the persistent cache capacity is 30 MB (about 30 pages). You can set the cache capacity by calling [OH_NativeArkWeb_SetBlanklessLoadingCacheCapacity](#oh_nativearkweb_setblanklessloadingcachecapacity). For details, see the description of this API. When the maximum capacity is exceeded, the cache is updated based on the Least Recently Used (LRU) mechanism. The persistent cache data that has been stored for more than seven days is automatically cleared. After the cache is cleared, the optimization effect appears when the page is loaded for the third time.
392> - If the similarity in [ArkWeb_BlanklessInfo](#arkweb_blanklessinfo) is extremely low, check whether the key value is correctly transferred.
393> - After this API is called, page loading snapshot detection and transition frame generation calculation are enabled, which generates certain resource overhead.
394> - Blankless loading consumes resources, which depends on the resolution of the **Web** component. It is assumed that a width and a height of the resolution are respectively **w** and **h**. When a page is opened, the peak memory usage increases by about **12×w×h** B. After the page is opened, the memory is reclaimed, which does not affect the stable memory usage. When the size of the solid-state application cache is increased, the increased cache of each page is about **w×h/10** B and the cache is located in the application cache.
395
396**Since**: 20
397
398**Parameters**
399
400| Name                                                | Description|
401|-----------------------------------------------------| -- |
402| const char* webTag  | Name of the **Web** component.|
403| const char* key | Key value that uniquely identifies the page.<br>The value cannot be empty and can contain a maximum of 2048 characters.<br>Invalid values do not take effect.|
404
405**Returns**
406
407| Type| Description|
408| -- | -- |
409| [ArkWeb_BlanklessInfo](#arkweb_blanklessinfo) | Prediction information about blankless loading, including the first screen similarity and first screen loading duration. The application determines whether to enable blankless loading based on the prediction information.|
410
411### OH_NativeArkWeb_SetBlanklessLoadingWithKey()
412
413```
414ArkWeb_BlanklessErrorCode OH_NativeArkWeb_SetBlanklessLoadingWithKey(const char* webTag, const char* key, bool isStarted)
415```
416
417**Description**
418
419Sets whether to enable blankless loading. This API must be used together with the [OH_NativeArkWeb_GetBlanklessInfoWithKey](#oh_nativearkweb_getblanklessinfowithkey) API.
420
421> **NOTE**
422>
423> - This API must be called after the page loading API is triggered. Other constraints are the same as those of [OH_NativeArkWeb_GetBlanklessInfoWithKey](#oh_nativearkweb_getblanklessinfowithkey).
424> - The page must be loaded in the component that calls this set of APIs.
425> - When the similarity is low, the system will deem the scene change too abrupt and frame insertion will fail.
426
427**Since**: 20
428
429**Parameters**
430
431| Name                                                | Description|
432|-----------------------------------------------------| -- |
433| const char* webTag  | Name of the **Web** component.|
434| const char* key | Key value that uniquely identifies the page. The value must be the same as the key value of the [OH_NativeArkWeb_GetBlanklessInfoWithKey](#oh_nativearkweb_getblanklessinfowithkey) API.<br>The value cannot be empty and can contain a maximum of 2048 characters.<br>When an invalid value is set, the error code [ArkWeb_BlanklessErrorCode](./capi-arkweb-error-code-h.md#arkweb_blanklesserrorcode) is returned and the frame insertion does not take effect.|
435| bool isStarted | Whether to enable frame insertion. The value **true** indicates to enable frame insertion, and **false** indicates the opposite.<br>The default value is **false**.|
436
437**Returns**
438
439| Type| Description|
440| -- | -- |
441| [ArkWeb_BlanklessErrorCode](./capi-arkweb-error-code-h.md#arkweb_blanklesserrorcode) | Whether the API is successfully called. For details, see [ArkWeb_BlanklessErrorCode](./capi-arkweb-error-code-h.md#arkweb_blanklesserrorcode).|
442
443### OH_NativeArkWeb_ClearBlanklessLoadingCache()
444
445```
446void OH_NativeArkWeb_ClearBlanklessLoadingCache(const char* key[], uint32_t size)
447```
448
449**Description**
450
451Clears the blankless loading cache of the page with a specified key value.
452
453In an applet or web application, when the content changes significantly during page loading, an obvious scene change may occur. If you are concerned about this change, you can use this API to clear the page cache.
454
455> **NOTE**
456>
457> - After the page is cleared, the optimization effect appears when the page is loaded for the third time.
458
459**Since**: 20
460
461**Parameters**
462
463| Name                                                | Description|
464|-----------------------------------------------------| -- |
465| const char* key[] | Key value list on the pages using the blankless optimization solution. The key value has been specified in [OH_NativeArkWeb_GetBlanklessInfoWithKey](#oh_nativearkweb_getblanklessinfowithkey).<br>Default value: key value list of all pages cached by the blankless optimization solution.<br>The key length cannot exceed 2048 characters, and the number of keys must be less than or equal to 100. The key value is the same as that input to the **Web** component during page loading.<br>If the key length exceeds 2048 characters, the key does not take effect. If the key length exceeds 100 characters, the first 100 characters are used. If the key length is NULL, the default value is used.|
466| uint32_t size | Size of the key array.<br>The default value is **0**.<br>The value ranges from 0 to 100.<br>When an invalid value is set, the value **0** is used.|
467
468
469### OH_NativeArkWeb_SetBlanklessLoadingCacheCapacity()
470
471```
472uint32_t OH_NativeArkWeb_SetBlanklessLoadingCacheCapacity(uint32_t capacity)
473```
474
475**Description**
476
477Sets the persistent cache capacity of the blankless loading solution and returns the value that takes effect. The default cache capacity is 30 MB, and the maximum cache capacity is 100 MB. When this limit is exceeded, transition frames that are not frequently used are eliminated.
478
479**Since**: 20
480
481**Parameters**
482
483| Name                                                | Description|
484|-----------------------------------------------------| -- |
485| uint32_t capacity  | Persistent cache capacity, in MB. The maximum value is 100 MB.<br>The default value is 30 MB.<br>The value ranges from 0 to 100. If this parameter is set to **0**, no cache capacity is available and the functionality is disabled globally.<br>When a value less than 0 is set, the value **0** takes effect. When a value greater than 100 is set, the value **100** takes effect.|
486
487**Returns**
488
489| Type| Description|
490| -- | -- |
491| uint32_t | The effective value that ranges from 0 MB to 100 MB.<br>When a value less than 0 is set, the value **0** takes effect. When a value greater than 100 is set, the value **100** takes effect.|
492