webview - 如何从 Assets 加载完整的网站?

标签 webview flutter local-web-server

是否有可能从本地 Assets 加载完整的网站(包括相关文件)?我尝试使用 flutter 插件 webview_flutter 并加载了 index.html。

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

只有 html 代码正在呈现,相关的 javascript 不工作。

最佳答案

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

与此同时,您可以在 Dart 中实现一个网络服务器,该服务器提供 Assets 中的文件并将 WebView 指向该集成网络服务器。

https://medium.com/@segaud.kevin/facebook-oauth-login-flow-with-flutter-9adb717c9f2e是关于如何在 Dart 中做到这一点。

关于webview - 如何从 Assets 加载完整的网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54617509/

相关文章:

Android WebView 不加载本地 HTML 文件

android - 应用程序因 base.apk!libmonochrome.so 而崩溃

android - android jelly Bean WebView 中的背景图像位置问题

android - 在 Android WebView 类中控制导航

火力地堡 : CONFIGURATION_NOT_FOUND

json - Flutter:使用 dio 包获取请求发送 JSON 正文

flutter - Flutter-选定时更改图标颜色