如何从资产加载完整的网站? [英] How to load complete website from assets?
问题描述
是否有可能从本地资产加载完整的网站(包括相关文件)?我用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屋!