问题描述
不久前我创建了一个“新标签,chrome 扩展”,它正在运行一个 React 应用程序。此扩展的功能之一是 Twitch 播放器,可以使用 iFrame 打开流以观看流。数据和 url 从开放的 Twitch API 中检索。这已经运行了很长时间,但大约一个月前它由于某种原因停止工作。
拒绝框架 'https://embed.twitch.tv/' 因为一个祖先 违反以下内容安全政策指令: “框架祖先 https://”。
值得一提的是,当我只运行 React App 时播放器就可以工作,所以它与 Chrome 扩展程序有关。
我对此问题进行了一些研究,发现这是 iFrame 中如何指定父级和引用者的问题。 iFrame 看起来像这样,其中大部分是在我构建和运行扩展程序时自动生成的。
<iframe src="https://embed.twitch.tv?autoplay=true&channel=<a channel>&height=720px&layout=video-with-chat&muted=false&parent=<id of my chrome extension>&referrer=chrome-extension%3A%2F%<id of my chrome extension>%2Fbuild%2Findex.html&style=%5Bobject%20Object%5D&targetId=twitch-embed&width=1280px" allowfullscreen="" scrolling="no" frameborder="0" allow="autoplay; fullscreen" title="Twitch" sandBox="allow-modals allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandBox" width="1280px" height="720px"></iframe>
由于我找不到任何有助于解决问题的内容,所以我想我尝试发布一个新帖子。有人能帮我解决这个问题吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)