pichillilorenzo / flutter_inappwebview

A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
https://inappwebview.dev
Apache License 2.0
3.15k stars 1.47k forks source link

profiles (cookies, auth, cache, history) for webview #788

Closed sandys closed 3 years ago

sandys commented 3 years ago

hi, I'm actually building a web testing tool using this library. I wonder if there's a way to separate multiple "profiles" for the inapp webview.

Each profile will be self contained - entire cookies, httpauth, history, cache, etc, basically everything. Chrome does have a profile folder, so is it possible to achieve something like that using this library ?

github-actions[bot] commented 3 years ago

πŸ‘‹ @sandys

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

pichillilorenzo commented 3 years ago

History is already webiew-specific. For the other things is not possible, otherwise, it would be already implemented/added. Unfortunately, there are no such native official APIs to make it possible.

Only for iOS, you may try to set the incognito: true WebView option, that uses the WKWebsiteDataStore.nonPersistent() native iOS class. But, because of this, unfortunately, you will lose WebView data (such as cookies, cache, etc) after app restart, because non-persistent WKWebsiteDataStore can't be saved to disk.

Note that this is not a limitation of this plugin or any other WebView plugin but of the native WebViews of the various Operating Systems. It is simply not possible until the Operating Systems add such features for their WebView view.

pichillilorenzo commented 3 years ago

Also, people may get confused thinking that a WebView is a Web Browser (such as Chrome, Firefox, Safari, etc.). It is not.

WebView: https://www.pcmag.com/encyclopedia/term/webview Web Browser: https://www.pcmag.com/encyclopedia/term/web-browser

sandys commented 3 years ago

Thank you for replying.

I'm aware of what a webview is (I'm an android developer in the past). But I was not sure if a webview allowed you to hook into the cookie, history, etc this way.

I saw https://www.theverge.com/2021/3/2/22309154/google-chrome-reading-list-new-profile-bookmarks-colors-features , so I wondered if that was possible. Thanks for clearing it up.

On Tue, 6 Apr, 2021, 21:53 Lorenzo Pichilli, @.***> wrote:

Also, people may get confused thinking that a WebView is a Browser (such as Chrome, Firefox, Safari, etc.). It is not.

WebView: https://www.pcmag.com/encyclopedia/term/webview Web Browser: https://www.pcmag.com/encyclopedia/term/web-browser

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pichillilorenzo/flutter_inappwebview/issues/788#issuecomment-814254670, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAASYU2I3FYS5KBKHW4QS6TTHMYRNANCNFSM42PBKMIA .

pichillilorenzo commented 3 years ago

No problem! Thanks to you! I was just clarifying it because a lot of people think that.

Also, you should consider that the Android Chrome app is not even using the WebView. It uses the same render engine and JavaScript engine, but other things are written in native C code and some Java code with "bridge". So, they have access to the "full power" of the engine. Hope Android and iOS adds support for such things! It would be very nice to have!

sandys commented 3 years ago

Thanks ! That makes a lot of sense.

I guess I'll have to compile chromium then :(

I was hoping to stay in Flutter ecosystem...but I guess I'll have to go back to java.

On Tue, 6 Apr, 2021, 22:12 Lorenzo Pichilli, @.***> wrote:

No problem! Thanks to you! I was just clarifying it because a lot of people think that.

Also, you should consider that the Android Chrome app is not even using the WebView. It uses the same render engine and JavaScript engine, but other things are written in native C code and some Java code with "bridge". So, they have access to the "full power" of the engine. Hope Android and iOS adds support for such things! It would be very nice to have!

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pichillilorenzo/flutter_inappwebview/issues/788#issuecomment-814267617, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAASYU3CWQV4GO3WVGZZ4YDTHM2XNANCNFSM42PBKMIA .

pichillilorenzo commented 3 years ago

I tried once but it got a lot complicated and it was taking so much time to compile that I gave up.

pichillilorenzo commented 3 years ago

However, you can stay in the Flutter ecosystem but then you need to expose the chromium methods that you want to use on Flutter.

pichillilorenzo commented 3 years ago

Also, this could be valid only for Android. On iOS, this won't be ever possible. Apple doesn't allow other WebViews than its native WKWebViewΒ to render web content.

sandys commented 3 years ago

Another path on this is to use a parallel space app - https://beebom.com/best-parallel-space-alternatives/

The opensource/commercial version of this engine is this - https://github.com/asLody/VirtualApp

On Tue, 6 Apr, 2021, 22:36 Lorenzo Pichilli, @.***> wrote:

However, you can stay in the Flutter ecosystem but then you need to expose the chromium methods that you want to use on Flutter.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pichillilorenzo/flutter_inappwebview/issues/788#issuecomment-814283641, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAASYU7435TANZGTBA6U52TTHM5R7ANCNFSM42PBKMIA .

sandys commented 3 years ago

sorry to msg on this issue, but wanted to find out if we can use a different webview than supplied by system for your plugin ? P.S. Android only I know.

For example, can I supply this webview as a jar file to flutter_inappwebview ?

https://github.com/delight-im/Android-AdvancedWebView

On Tue, Apr 6, 2021 at 10:41 PM Sandeep @.***> wrote:

Another path on this is to use a parallel space app - https://beebom.com/best-parallel-space-alternatives/

The opensource/commercial version of this engine is this - https://github.com/asLody/VirtualApp

On Tue, 6 Apr, 2021, 22:36 Lorenzo Pichilli, @.***> wrote:

However, you can stay in the Flutter ecosystem but then you need to expose the chromium methods that you want to use on Flutter.

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pichillilorenzo/flutter_inappwebview/issues/788#issuecomment-814283641, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAASYU7435TANZGTBA6U52TTHM5R7ANCNFSM42PBKMIA .

pichillilorenzo commented 3 years ago

Nope, it doesn't make any sense because the WebView needs to work with the Flutter with Message Channels. You need to implement that kind of Flutter - Android (or any other platform) 2-way communication. In any case, what is the problem? Is there a feature missing?