• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Class (WebCookie)
2
3Manages behavior of cookies in **Web** components. All **Web** components in an application share a **WebCookie**. You can use the **getCookieManager** API in **controller** to obtain the **WebCookie** for subsequent cookie management.
4
5> **NOTE**
6>
7> - 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.
8>
9> - The initial APIs of this class are supported since API version 8.
10>
11> - You can preview how this component looks on a real device, but not in DevEco Studio Previewer.
12
13## constructor
14
15constructor()
16
17Constructs a **WebCookie** object.
18
19**System capability**: SystemCapability.Web.Webview.Core
20
21## setCookie<sup>(deprecated)</sup>
22
23setCookie()
24
25Sets the cookie. This API returns the result synchronously. **true** is returned if the operation is successful; otherwise, **false** is returned.
26
27This API is deprecated since API version 9. You are advised to use [setCookie<sup>9+</sup>](./arkts-apis-webview-WebCookieManager.md#setcookiedeprecated) instead.
28
29**System capability**: SystemCapability.Web.Webview.Core
30
31## saveCookie<sup>(deprecated)</sup>
32
33saveCookie()
34
35Saves the cookies in the memory to the drive. This API returns the result synchronously.
36
37This API is deprecated since API version 9. You are advised to use [saveCookieAsync<sup>9+</sup>](./arkts-apis-webview-WebCookieManager.md#savecookieasync) instead.
38
39**System capability**: SystemCapability.Web.Webview.Core
40