首页 文章

违反了具有星号值的框架祖先

提问于
浏览
1

今天我在chrome和safari中遇到了这个奇怪的控制台错误:

拒绝在框架中显示...因为祖先违反了以下内容安全策略指令:“frame-ancestors *” .

怎么可能违反*?语法错了吗?

1 回答

  • 0

    这应该是一个评论,但我没有足够的声誉 . 我今天花了很多时间尝试将Twitter时间线嵌入到React-Native WebView中 . 获得时间表后,我发现我面对的视频无效 . 将WebView连接到chrome devtools我发现我遇到了和你一样的错误 .

    在React-Native webview中,您可以传递HTML以显示和'baseUrl':

    source={{
      html: '<html><body>Some stuff that generates a twitter timeline in an iframe</body></html>',
      baseUrl: ''
    }}>
    

    我已经将我的设置为空,如上所述,我认为创建一个带有网址的网页视图' about:blank '. When I changed it to ' https://www.twitter.com ', the frame-ancestors violation dissappeared and the video played successfully. I then changed the url to ' https://www.ifThisIsEmptyThenVideoWillNotPlay.com ' and it still worked, so I guess it just has to be a url. I'我不确定这是否会有所帮助,但我觉得我必须把它放在某个地方,因为它对我来说似乎模糊不清 . ..

相关问题