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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…