cookie的读、写和删除操作

cookie的读、写和删除操作

HarmonyOS
2024-08-07 08:58:51
945浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
克里斯蒂东
operationMethod(): void {
  try {
    if (this.buttonType === CookieOperation.GET_COOKIE) {
      let originCookie = web_webview.WebCookieManager.fetchCookieSync(CommonConstants.USER_CENTER_URL);
      showDialog(originCookie);
    } else if (this.buttonType === CookieOperation.SET_COOKIE) {
      web_webview.WebCookieManager.configCookieSync(CommonConstants.USER_ABOUT_URL, 'info=测试cookie写入');
      showDialog($r('app.string.write_success'));
    } else if (this.buttonType === CookieOperation.DELETE_COOKIE) {
      web_webview.WebCookieManager.clearAllCookiesSync();
      let deleteMessage = $r('app.string.delete_success');
      showDialog(deleteMessage);
    } else {
      router.pushUrl({
        url: CommonConstants.PAGE_VERIFY
      })
    }
  } catch (error) {
    showDialog('Operation failed.'+JSON.stringify(error));
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
分享
微博
QQ
微信
回复
2024-08-07 11:06:20


相关问题
HarmonyOS NFC卡场景demo?
605浏览 • 1回复 待解决
HarmonyOS Webviewcookie部分字段丢失
599浏览 • 1回复 待解决
HarmonyOS 怎么删除cookie里某一项
607浏览 • 1回复 待解决
HarmonyOS HTTP cookie管理使用
603浏览 • 1回复 待解决
PolarDB 行如何从块中
2665浏览 • 1回复 待解决
能否同步webviewcookie与app中cookie
1834浏览 • 1回复 待解决
HarmonyOS HarmonyOS视频流操作
672浏览 • 1回复 待解决
解析操作ASN.1数据工具
2105浏览 • 1回复 待解决