tauri-apps / wry

Cross-platform WebView library in Rust for Tauri.
Apache License 2.0
3.69k stars 279 forks source link

Share web storage between multi windows #621

Open keiya01 opened 2 years ago

keiya01 commented 2 years ago

Is your feature request related to a problem? Please describe.

If user need to share web storage like cookie, local storage between windows, user need to share process. Maybe we can access from JavaScript but we need to test. In a case like #518, webview cookie is not synced, so we need to use ProcessPool. This is similar to #590 but this issue is a different perspective.

Describe the solution you'd like I think we can use WKProcessPool on macos. And maybe we need to share web storage on linux and windows too.

Describe alternatives you've considered Use DB like sqlite3 instead of web storage.

Would you assign yourself to implement this feature?

Additional context Add any other context or screenshots about the feature request here.

wusyong commented 2 years ago

I noticed your latest comment in https://github.com/tauri-apps/wry/issues/518#issuecomment-1162514645 and thought about this. If there's no direct access API for all platforms, it's probably not worth it. The alternative like sqlite should be plugins for Tauri.

keiya01 commented 2 years ago

If there's no direct access API for all platforms, it's probably not worth it.

I think so. But we can access JS API like document.cookie, localStorage, etc on linux and macOS. And windows is not allowed to access to these API in JavaScript. Additionally I noticed that these storage can not be shared between multi webview on linux and maybe windows but on macOS we can access to these storage between multi webview.

So we can also advance to use DB like sqlite but I think these DB is too much to store a little data like color scheme, users info as cache...

keiya01 commented 2 years ago

On windows we need to support like https://github.com/MicrosoftEdge/WebView2Feedback/issues/273 if we will support web storage.

keiya01 commented 2 years ago

BTW I could not access window.localStorage and document.cookie on windows. I wonder there is a problem in my code or we need some setting in webview2...