How can I set a cookie which would be applicable for just a specific tab in the browser? Chrome keeps cookies separated for normal mode and incognito mode. What i'm trying to achieve is similar to this but i want to do that for every tab in normal mode.
If I understand correctly, you have a tab based application with a WebView2
on each tab and you want a separate environment for each WebView2
so they have their own cookies.
There's an example of setting up an environment here: Getting started with WebView2 Go to Step 3 .
The second argument to CreateCoreWebView2EnvironmentWithOptions
is the userdatafolder . This must be unique to each tab.
You can for instance create a random folder name or add the tab index to the folder name.
Now the webview2 controls will have their own environment, including cache and cookies .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.