#鸿蒙通关秘籍#项目开发的过程中,有一个需求在隐私模式下,查询是否存在Cookie,可以用什么吗?

HarmonyOS
2024-12-13 10:50:33
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
银月清辉WAN

我们如果要查询,隐私模式下,一个Cookie存在的情况,你可以通过existCookie()接口实现。

import { webview } from '@kit.ArkWeb';
@Entry
@Component
struct WebComponent {
    controller: webview.WebviewController = new webview.WebviewController();
    build() {
        Column() {
            Button('existCookie')
            .onClick(() => {
                let result = webview.WebCookieManager.`existCookie`(true);
                console.log("result: " + result);
            })
            Web({ src: 'www.example.com', controller: this.controller, incognitoMode: true })
        }
    }
}
分享
微博
QQ
微信
回复
2024-12-13 11:47:27
相关问题
请教一个sql查询需求
2847浏览 • 1回复 待解决
如何清除Web隐私模式所有cookie
1065浏览 • 1回复 待解决
请问鸿蒙可以用什么控件开发短视频
7170浏览 • 1回复 待解决
HarmonyOS 可以用仓颉开发HarmonyOS
440浏览 • 1回复 待解决