android - 在 Webview 中运行 html 标签脚本
问题描述
我有一项服务,它返回一个 html 代码以在我的应用程序的 web 视图上呈现,有时它返回一个 youtube 嵌入、istagram 或 facebook,但 facebook 是唯一一个不工作的服务。
"<script async=\"1\" defer=\"1\" crossorigin=\"anonymous\" src=\"https://connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v8.0\" nonce=\"dUFa7MFK\"></script><div class=\"fb-video\" data-href=\"https://www.facebook.com/terradememe/videos/222040112417866\"><blockquote cite=\"https://www.facebook.com/terradememe/videos/222040112417866/\" class=\"fb-xfbml-parse-ignore\"><a href=\"https://www.facebook.com/terradememe/videos/222040112417866/\">Algumas histórias assustadoras!</a><p>Algumas histórias assustadoras!\n"
这只是身体的一部分,在 facebook 视频上,我们将其放在script
标签上,当我播放视频时,应用程序冻结并且什么也不做,但如果我按下后退按钮,应用程序会将其恢复为正常行为。
我看到了一个使用 a 的解决方案,iframe
但就我而言,我需要使用script
.
过了一会儿,我注意到了这个日志:
"Refused to load the image 'android-webview-video-poster:default_video_poster/-1751309467915793562' because it violates the following Content Security Policy directive: "default-src * data: blob: 'self'". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback."
有人遇到过同样的问题吗?
解决方案
推荐阅读
- python - 计算数学表达式的方法
- reporting-services - 通过对最大数字求和来计算总数
- python - Tensorflow 2.2:Iterator.make_initializer 返回无
- c# - 如何在 C#/Win32 api 中找到 Windows 应用程序执行别名的目标?
- laravel - Laravel 模型关系也会自动获取所有其他模型关系
- python - 验证子目录的大小
- javascript - 如何在角度循环中获取索引?
- video - FFmpeg:从具有不同片段持续时间的相同输入视频生成的 M3U8 播放列表的 MD5 哈希(应用视频过滤器后)不匹配
- r - 列线图因子名称错误不在设计中:model.type x time event x.df lambda pred.at
- amazon-web-services - 使用本地 Docker 容器调用 AWS 批处理和汇总作业并在作业完成后发布数据