Web隐私模式下如何设置隐私模式下指定url的单个cookie的值

Web隐私模式下如何设置隐私模式下指定url的单个cookie的值

HarmonyOS
2024-08-06 18:45:02
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
落月无痕
import web_webview from '@ohos.web.webview';
import business_error from '@ohos.base';
......
try {
  // configCookieSync第三个参数表示获取隐私模式(true)或非隐私模式(false)下,对应url的cookies。
  web_webview.WebCookieManager.configCookieSync('https://www.example.com', 'a=b', true);
} catch (error) {
  let e:business_error.BusinessError = error as business_error.BusinessError;
  console.error(`ErrorCode: ${e.code},  Message: ${e.message}`);
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
分享
微博
QQ
微信
回复
2024-08-06 20:22:30
相关问题
如何清除Web隐私模式所有cookie
1416浏览 • 1回复 待解决
HarmonyOS web使用隐私模式
1298浏览 • 1回复 待解决
设置禁止截屏隐私模式
2624浏览 • 1回复 待解决
隐私模式设置后窗口是如何展示
2390浏览 • 1回复 待解决
如何为网页设置单个Cookie
1194浏览 • 1回复 待解决
如何设置Web组件深色模式
1077浏览 • 1回复 待解决