gpt4 book ai didi

android - Flutter:从 WebView 加载 IFrame

转载 作者:IT王子 更新时间:2023-10-29 06:58:39 26 4
gpt4 key购买 nike

我正在寻找一种从 Flutter WebView ( webview_flutter: ^0.1.2) 加载 iFrame 的方法,但找不到任何相关信息。

                 Container(
child: WebView(
initialUrl: 'https://www.youtube.com/embed/abc',
javaScriptMode: JavaScriptMode.unrestricted,
)),

知道如何将 IFrame 传递给 Webview,它会作为 initialUrl 的一部分吗?我已经尝试过相同的方法,但它没有正确加载。

最佳答案

这可能会做你想做的事

 Container(
child: WebView(
initialUrl: Uri.dataFromString('<html><body><iframe src="https://www.youtube.com/embed/abc"></iframe></body></html>', mimeType: 'text/html').toString(),
javascriptMode: JavascriptMode.unrestricted,
)),

这会传递一个包含带有 iframe 的 HTML 页面的数据 URL。

关于android - Flutter:从 WebView 加载 IFrame,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54464853/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com