You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am developing a Windows desktop application that can host up to eight WebView2 instances at the same time.
Currently, every WebView2 instance uses the same User Data Folder, so cookies, LocalStorage, IndexedDB, cache, and sign-in state may be shared between all of them.
In the future, I may need to isolate storage only for specific WebView2 instances depending on the content being displayed.
The instances that need isolation are not fixed slots such as "window 1" or "window 2". They would be selected dynamically based on a per-video check.
For example:
normal videos would continue using the existing shared User Data Folder
a video requiring isolated storage would use a separate storage context only for that WebView2 instance
At the moment, my application does not actually create the isolated WebView2 instances yet. I am trying to determine the correct architecture before implementing it.
I have looked at several possible approaches:
Create a separate CoreWebView2Environment with a different User Data Folder.
Use a separate CoreWebView2Profile.
Create a temporary User Data Folder only for the isolated WebView2 instance.
What I am not sure about is which approach is recommended when shared and isolated WebView2 instances need to coexist in the same process.
My main questions are:
Can WebView2 instances using a shared User Data Folder and WebView2 instances using isolated storage safely coexist in the same application process?
If I need to isolate cookies, LocalStorage, IndexedDB, cache, and sign-in state for only one WebView2 instance, should I create a separate CoreWebView2Environment with a different User Data Folder, or is a separate CoreWebView2Profile more appropriate?
If the isolation requirement changes dynamically after a content check, should I destroy and recreate the WebView2 controller/environment rather than trying to switch storage on an existing controller?
If the isolated storage does not need to persist after that WebView2 instance is closed, what is the recommended cleanup approach?
I would like to keep the existing shared environment for most WebView2 instances and only create isolated storage when necessary, rather than creating a separate environment/profile for all eight instances.
I would appreciate guidance on the recommended WebView2 architecture for this scenario.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I am developing a Windows desktop application that can host up to eight WebView2 instances at the same time.
Currently, every WebView2 instance uses the same User Data Folder, so cookies, LocalStorage, IndexedDB, cache, and sign-in state may be shared between all of them.
In the future, I may need to isolate storage only for specific WebView2 instances depending on the content being displayed.
The instances that need isolation are not fixed slots such as "window 1" or "window 2". They would be selected dynamically based on a per-video check.
For example:
At the moment, my application does not actually create the isolated WebView2 instances yet. I am trying to determine the correct architecture before implementing it.
I have looked at several possible approaches:
What I am not sure about is which approach is recommended when shared and isolated WebView2 instances need to coexist in the same process.
My main questions are:
Can WebView2 instances using a shared User Data Folder and WebView2 instances using isolated storage safely coexist in the same application process?
If I need to isolate cookies, LocalStorage, IndexedDB, cache, and sign-in state for only one WebView2 instance, should I create a separate CoreWebView2Environment with a different User Data Folder, or is a separate CoreWebView2Profile more appropriate?
If the isolation requirement changes dynamically after a content check, should I destroy and recreate the WebView2 controller/environment rather than trying to switch storage on an existing controller?
If the isolated storage does not need to persist after that WebView2 instance is closed, what is the recommended cleanup approach?
I would like to keep the existing shared environment for most WebView2 instances and only create isolated storage when necessary, rather than creating a separate environment/profile for all eight instances.
I would appreciate guidance on the recommended WebView2 architecture for this scenario.
All reactions