1

Where does WebView2 store cookies on Win 10? And is it possible to view them, delete them and whitelist them via the app using WebView2? Any links to online documentation would be appreciated.

Hugh Jarce
  • 11
  • 1
  • 3

1 Answers1

1

User data folder

WebView2 stores all state including cookies, localStorage, indexeddb and so on, in the user data folder. By default the user data folder is distinct for each host executable but you can change the user data folder. You can read more about managing user data folders in the WebView2 documentation.

Cookie API

You can use the WebView2.CoreWebView2.CookieManager to view, add, remove and so on cookies.

David Risney
  • 3,886
  • 15
  • 16
  • Thanks for your reply. What about whitelisting cookies? Is it possible to do that so users aren't presented with EU GDPR cookie notifications even if the other cookies are deleted? – Hugh Jarce Mar 02 '21 at 19:15
  • You can use the CookieManager to enumerate and delete or not delete specific cookies as you like. – David Risney Mar 03 '21 at 01:45
  • Is not deleting cookies the same as specifically whitelisting them? – Hugh Jarce Mar 04 '21 at 09:18