我正在尝试将powerpoint演示文稿嵌入到Sharepoint的powerpoint查看器中,在一个角度应用程序(v14)的iframe中。不幸的是,我收到了以下错误消息:
拒绝设置'https://{my}.sharepoint.com/‘,因为一个祖先违反了以下内容安全策略指令:“框架-祖先’teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com *.powerapps.com *.yammer.com *.officeapps.live.com *.office.com *.Stre.azure-test.net *.microsoftstream.com *.dynamics.com *.microsoft.com securebroker.sharepointonline.com”。
在这里,我的守则:
constructor(
private sanitizer: DomSanitizer
) {
this.trustedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.externalUrl as string);
}
<iframe [src]="trustedUrl" width="100%" frameborder="0">This is an embedded <a target="_blank" href="https://office.com">Microsoft Office</a> presentation, powered by <a target="_blank" href="https://office.com/webapps">Office</a>.</iframe>
如果我直接在没有trustedUrl变量的情况下设置url,它可以工作:
<iframe [src]="'https://{my}.sharepoint.com/personal/{myuser}/_layouts/15/Doc.aspx?sourcedoc={mypresentationid}&action=embedview'" width="100%" frameborder="0">This is an embedded <a target="_blank" href="https://office.com">Microsoft Office</a> presentation, powered by <a target="_blank" href="https://office.com/webapps">Office</a>.</iframe>
发布于 2022-11-15 12:12:32
我找到了解决方案,代码是正确的。该网址是错误的,正确的网址是https://{my}.sharepoint.com/personal/{myuser}/_layouts/15/Doc.aspx?sourcedoc={mypresentationid}&action=embedview.
如果Url中缺少&action=embedview,则错误
拒绝设置“https://{my}.sharepoint.com/”框架,因为一个祖先违反了以下命令
奥考斯。
https://stackoverflow.com/questions/74408811
复制