Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Persistence #4713

Open
Slion opened this issue Jul 28, 2024 · 4 comments
Open

[Feature]: Persistence #4713

Slion opened this issue Jul 28, 2024 · 4 comments
Labels
feature request feature request

Comments

@Slion
Copy link

Slion commented Jul 28, 2024

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

@Slion Slion added the feature request feature request label Jul 28, 2024
@victorhuangwq
Copy link
Collaborator

victorhuangwq commented Jul 29, 2024

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?

@Slion
Copy link
Author

Slion commented Jul 30, 2024

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:

  • load and save
  • internalize and externalize
  • deserialize and serialize

Hope that helps you understand what I'm looking for.

@Slion
Copy link
Author

Slion commented Sep 6, 2024

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.

@Slion
Copy link
Author

Slion commented Sep 12, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request feature request
Projects
None yet
Development

No branches or pull requests

2 participants