android - Flutter WebView window.close()不起作用(Android)

标签 android flutter android-webview flutterwebviewplugin webview-flutter

我无法使用带有 window.close() 的 webview flutter 关闭打开的网页功能。

我正在使用 webview_flutter在我的应用程序中。我一直在使用的网站有一个 window.open()该函数将打开一个包含不同 URL 的新窗口。在新窗口中,有一个关闭按钮可以使用 window.close() 关闭新窗口.当我在笔记本电脑和移动设备中使用浏览器测试它时,它工作正常,但当我使用上述 webview 插件在 Flutter 应用程序上尝试它时,它不起作用。

当我点击关闭按钮时,我在日志中收到此警告。

Scripts may close only the windows that were opened by it.



我还尝试了其他插件,例如 flutter_webview_plugin ,但也没有运气。

所以我想知道 Flutter webview 的这个功能是否已经可用?

请帮助我,非常感谢任何建议或解决方案。谢谢大家!

更新 :
我已经过测试但仍然无法使用的软件包
  • flutter_inappwebview
  • url_launcher
  • 最佳答案

    尝试使用它,它简单易用package 使用自述文件中的示例

    关于android - Flutter WebView window.close()不起作用(Android),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62152356/

    相关文章:

    Flutter StreamProvider 使用了一个 `BuildContext`,它是提供者的祖先

    firebase - 有没有为 flutter 桌面使用 firebase 存储?

    android - 在 NPObject 上调用方法时出错!在安卓 2.2

    java - 如果我使用和不使用 IvParameterSpec 初始化 AES 密码,有什么区别吗

    android - 如何在 Android 的 Youtube API V3 中通过 channel ID 获取 Youtube 直播流?

    json - 从 Flutter 中的 Rapid API 获取 json 数据(Dart)

    java - WebView 第二次显示黑屏?

    带有 css 和 javascript 的 Android WebView

    android从数据库中分离表格的行

    android - 为 2 模块项目中的单个模块启用 ProGuard