[Feature]: Persistence
Describe the feature/enhancement you need
I need to persist WebView2 states when the application is restarted.
The scenario/use case where you would use this feature
For instance a web browser with multiple persistent tabs would need this. At the very least each tab should be able to persist its navigation history, including URLs and scroll positions.
How important is this request to you?
Critical. My app's basic functions wouldn't work without it.
Suggested implementation
Take a look at how this is done on Android WebView saveState and restoreState.
What does your app do? Is there a pending deadline for this request?
This is a showstopper. Can't release the app without that feature. We'll need to look at alternatives to Microsoft Edge WebView2.
References
#4711 StackOverflow #4712
Could you better describe what are you trying to do with the state persistence? What does your application do, and why is this important for it?
The application is a web browser and it needs to persist its tabs. Say you have 4 tabs open, each one is using a WebView, each of them are currently looking at a web page at a given scroll offset but they also each have a navigation history, sometimes called back and forward stack. We need to be able to persist at least all that information so that when the user closes the application and reopens it she can resume web browsing exactly as it was.
As mentioned above this is easily done on Android WebView. I have not seen anything like that with WebView2. Did I miss it somehow? This is about enabling persistence which is a fairly basic software concept. In the case of complex objects like WebView it is possibly not just about navigation history and scroll offset. Their is likely a bunch of other data you may need or want to persist.
As with Android WebView, it is often implemented as a pair of methods often called as follow:
loadandsaveinternalizeandexternalizedeserializeandserialize
Hope that helps you understand what I'm looking for.
Basically I have a WebView in my application with all its travellog history I want to be able to close the app and restore it exactly as it was. This is badly missing at the moment it seems, which I find is a major oversight considering how easy it is to achieve on other platforms such as Android.
Even in Edge page scroll offset is not persisted only the travel logs. Though until you restart your session scroll offset is kept as expected as you go back or forward in your travel logs.