如何从资产加载完整的网站? [英] How to load complete website from assets?

查看:76
本文介绍了如何从资产加载完整的网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能从本地资产加载完整的网站(包括相关文件)?我用Flutter插件webview_flutter进行了尝试,并加载了index.html.

Is there any possibility to load complete website (including associated files) from local assets ? I tried it with flutter plugin webview_flutter and loaded index.html.

  Future<String> loadLocal() async {
    return await rootBundle.loadString('assets/mywebsite/index.html');
  }

仅呈现html代码,并且相关的javascript无法正常工作.

only html code is being rendered and associated javascripts are not working.

推荐答案

您可以关注 https: //github.com/flutter/flutter/issues/27086

同时,您可以在Dart中实现一个Web服务器,该Web服务器提供资产中的文件并将Webview指向该集成Web服务器.

In the meantime you can implement a web server in Dart that serves files from assets and point the webview to that integrated web server.

https://medium.com/@ segaud.kevin/facebook-oauth-login-flow-with-flutter-9adb717c9f2e 有关如何在Dart中进行此操作.

https://medium.com/@segaud.kevin/facebook-oauth-login-flow-with-flutter-9adb717c9f2e is about how to do that in Dart.

这篇关于如何从资产加载完整的网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆