1

I'm currently working on flutter_webview_plugin and I'm opening up my company website inside the webview, The thing is website shows error if suddenly someone turns off the internet (I know This is how it suppose to work) But is there any way I can save the whole website in the storage so it works without the Internet (I know this is kind of ridiculous)? It will be great if you can answer this with flutter_webview_plugin perspective. Thanks

Sarthak Solanki
  • 468
  • 1
  • 6
  • 18
  • you can load `HTML` code into the webview, or even local file (web site from local multiple files even) – Vladyslav Matviienko Jun 19 '19 at 06:44
  • Can you explain to me how? How would I get all the credentials of the angular file inside just a single HTML? – Sarthak Solanki Jun 19 '19 at 07:57
  • I've not come across an offline/read later web viewer, not sure how hard it would be to create your own widget – F-1 Jun 19 '19 at 10:24
  • If you need to log in to web site, you likely won't be able to use it offline. Only saving static data makes sense. You can try to run your entire angular server on the mobile device, but firstly, depending on the functionality, it may be simply too large , or too heavy for a mobile device. What I'd do is implement the API instead of using WebView, and cached the data from API for offline usage – Vladyslav Matviienko Jun 19 '19 at 10:39
  • I'm dropping this idea, There is too much work needed for this to work, Since The website updates through API (getting the data), Also even if I store the whole website inside the flutter end I'll still need to call API to get the data Which require internet, Anyway thanks for all the replies :) – Sarthak Solanki Jun 19 '19 at 11:17
  • @F-1 I don't think I need to create "Widget" for that it's more of plugin work and flutter_webview & flutter_webview_plugin support loading offline HTML tags for a basic page. Anyway thanks, Bud! – Sarthak Solanki Jun 19 '19 at 11:20

1 Answers1

0

You can try this:

Uri.dataFromString('<html><body>hello world</body></html>', mimeType: 'text/html').toString()
Pushp
  • 1,064
  • 10
  • 18
  • This just opens up some basic HTML tags, right? I can't code the whole company website inside this. – Sarthak Solanki Jun 19 '19 at 06:01
  • is there multiple files? if yes then try https://stackoverflow.com/a/54617548/5725512 – Pushp Jun 19 '19 at 06:10
  • Again its a whole a lot big angular project, not just some regular multiple HTML files, What I need is a way to kind of saving website to the local storage. So it can work offline also – Sarthak Solanki Jun 19 '19 at 07:00