-
Notifications
You must be signed in to change notification settings - Fork 936
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
support LocalStorage #51
support LocalStorage #51
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks :)
@jparound30 I tried to use it in my project but I don't know how to. Could you please spare some minutes to give me a code example on how to use your feature to set local storage for webview? I posted [my question] (https://stackoverflow.com/questions/50960945/flutter-webivew-how-to-set-local-storage) but unfortunately no one was able to help me. I would really appreciate it if you could show me how in the code. Many thanks |
Unfortunately, I was not considering operating LocalStorage from outside WebView. Although I tried a little investigation, You may be able to avoid it by waiting until the first page loading is completed and then accessing LocalStorage with evalJavascript. like this. // On urlChanged stream
StreamSubscription<WebViewStateChanged> _onStateChanged;
_onStateChanged = flutterWebviewPlugin.onStateChanged.listen((WebViewStateChanged state) {
if (mounted) {
if (state.type == WebViewState.finishLoad) {
flutterWebviewPlugin.evalJavascript(
"window.localStorage.setItem('LOCAL_STORAGE','SOMETOKEN');" +
"document.getElementById('showLocalStorageBtn').click();"
);
}
}
}); i hope you will find it helpful. thanks. |
Thank you for your help! |
Thanks for the plugin, it seems to be exactly what I'm looking for, but I'm not sure if I'm using it correctly. I use the flutter webview plugin to play video from firebase storage, and expected that after the playing the video once, it would play it next time from local storage. Did I misunderstood the use? Actually, I wasn't able to find some instructions... I would really appreciate some instructions of how to use the plugin. I've tried to use it like this:
|
@crnaosa
There is no functional relationship with |
Understood, thanks for clarifying. |
related #48
best regards.