harmony 鸿蒙ArkWeb_CookieManagerAPI

2025-06-12 浏览 (1)

ArkWeb_CookieManagerAPI

Overview

Defines the native cookie manager APIs provided by ArkWeb. Before calling the API, you are advised to use ARKWEB_MEMBER_MISSING to check whether the function struct has the corresponding pointer to avoid crash caused by mismatch between the SDK and the device ROM.

Since: 12

Related module: Web

Summary

Member Variables

NameDescription
size_t sizeSize of the struct.
ArkWeb_ErrorCode(* fetchCookieSync )(const char *url, bool incognito, bool includeHttpOnly, char **cookieValue)Pointer to the function used to obtain the cookie value of a specified URL.
ArkWeb_ErrorCode(* configCookieSync )(const char *url, const char *cookieValue, bool incognito, bool includeHttpOnly)Pointer to the function used to set the cookie value of a specified URL.
bool(* existCookies )(bool incognito)Pointer to the function used to check whether the cookie exists.
void(* clearAllCookiesSync )(bool incognito)Pointer to the function used to clear all cookies.
void(* clearSessionCookiesSync )()Pointer to the function used to clear all session cookies.

Member Variable Description

clearAllCookiesSync

void(* ArkWeb_CookieManagerAPI::clearAllCookiesSync) (bool incognito)

Description

Pointer to the function used to clear all cookies.

Parameters

NameDescription
incognitoWhether to clear all cookies in incognito mode (true) or in non-incognito mode (false)

configCookieSync

ArkWeb_ErrorCode(* ArkWeb_CookieManagerAPI::configCookieSync) (const char *url, const char *cookieValue, bool incognito, bool includeHttpOnly)

Description

Pointer to the function used to set the cookie value of a specified URL.

Parameters

NameDescription
urlThe URL to which the cookie belongs. It must be a complete URL.
cookieValueCookie value to set.
incognitoWhether to set the cookie of corresponding URL in incognito mode (true) or in non-incognito mode (false).
includeHttpOnlyWhether the cookie marked as HttpOnly can be overwritten.

Returns

Returns ARKWEB_SUCCESS if the cookie is set successfully; returns ARKWEB_INVALID_URL if the URL is invalid; returns ARKWEB_INVALID_COOKIE_VALUE if the cookie value is invalid.

existCookies

bool(* ArkWeb_CookieManagerAPI::existCookies) (bool incognito)

Description

Pointer to the function used to check whether the cookie exists.

Parameters

NameDescription
incognitoWhether the cookie exists in incognito mode (true) or in non-incognito mode (false).

Returns

Returns true if the cookie exists; returns false if the cookie does not exist.

fetchCookieSync

ArkWeb_ErrorCode(* ArkWeb_CookieManagerAPI::fetchCookieSync) (const char *url, bool incognito, bool includeHttpOnly, char **cookieValue)

Description

Pointer to the function used to obtain the cookie value of a specified URL.

Parameters

NameDescription
urlURL of the cookie to obtain. A complete URL is recommended.
incognitoWhether to obtain the webview memory cookie in incognito mode() or in non-incognito mode.
includeHttpOnlyWhether to include the cookie marked as HttpOnly.
cookieValueCookie value of the corresponding URL.

Returns

Returns ARKWEB_SUCCESS if the cookie is obtained successfully; returns ARKWEB_INVALID_URL if the URL is invalid; returns ARKWEB_INVALID_PARAM if the cookie value is invalid.

size

size_t ArkWeb_CookieManagerAPI::size

Description

Size of the struct.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkWeb API Reference

harmony 鸿蒙ArkWeb_AnyNativeAPI

harmony 鸿蒙ArkWeb_ComponentAPI

harmony 鸿蒙ArkWeb_ControllerAPI

harmony 鸿蒙ArkWeb_JavaScriptBridgeData

harmony 鸿蒙ArkWeb_JavaScriptObject

harmony 鸿蒙ArkWeb_JavaScriptValueAPI

harmony 鸿蒙ArkWeb_ProxyMethod

harmony 鸿蒙ArkWeb_ProxyMethodWithResult

harmony 鸿蒙ArkWeb_ProxyObject

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