我是没有AngularJS经验的Angular 2的新手,并且正在编写一个涉及设置iframe src属性的教程:
<iframe width="100%" height="300" src="{{video.url}}"></iframe>
Run Code Online (Sandbox Code Playgroud)
这引发了一个异常:
Error: unsafe value used in a resource URL context
at DomSanitizationServiceImpl.sanitize...
Run Code Online (Sandbox Code Playgroud)
我已经尝试过使用绑定但iframe没有成功.我可能错过了一些东西,我很难找到解决方案.
我在我的网页中嵌入了一个iFrame,如下所示:
var iframeProps = {
'data-type': self.props.type,
allowTransparency: self.props.allowTransparency,
className: self.props.className,
frameBorder: self.props.frameBorder,
height: self.props.height,
key: url,
onLoad: self.props.onLoad.bind(self),
scrolling: self.props.scrolling,
src: self.state.isActive ? url : '',
style: self.props.styles,
width: self.props.width
};
<iframe {...iframeProps} />
Run Code Online (Sandbox Code Playgroud)
这在控制台中引发了错误
拒绝在框架中显示" https://twitter.com/ ...."因为祖先违反了以下内容安全策略指令:"frame-ancestors'self'".
谁能告诉我怎样才能做到这一点?