angular - 拒绝在框架中显示“URL”,因为它将“X-Frame-Options”设置为“sameorigin”以显示 PDF
问题描述
我参考了https://angular.io/guide/security#xss并尝试在我们的 Intranet sharePoint 网站上的网页上显示 PDF
这是模板:help.component.html:
<iframe class="e2e-iframe-trusted-src" width="640" height="390" [src]="trustedUrl" ></iframe>
和组件:help.component.ts
import { Component, OnInit } from '@angular/core';
import { SessionResetService } from '../../services/session-reset.service';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
@Component({
selector: 'app-help',
templateUrl: './help.component.html',
styleUrls: ['./help.component.scss']
})
export class HelpComponent implements OnInit {
public trustedUrl: SafeUrl;
public helpUrl: string;
constructor(private _resetSession: SessionResetService,
private sanitizer: DomSanitizer) {
this.helpUrl = "https://website Url/Tool.pdf";
this.trustedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.helpUrl);
}
ngOnInit() {
this._resetSession.CallResetSession();
}
}
我尝试按照建议附加 &embedded=true: How to fix Refused to display in a frame because it set 'X-Frame-Options' to 'sameorigin
但这也不起作用。请指导
解决方案
推荐阅读
- sql - MS Access 中的错误:运行时错误“424”:需要对象
- safari - 如何将 ARReferenceObject 文件转换为 USDZ 文件?
- python - 在python中计算netcdf文件几年的年度异常
- sql-server - SQL Server:从结果集中删除子字符串结果
- c++ - 多线程减慢程序:没有虚假共享,没有互斥体,没有缓存未命中,没有小的工作量
- html - 背景颜色显示为细边框
- r - R中相似含义的聚类短语
- c - 在 c 中读取文本文件时忽略文本文件中的随机数量的空白
- string - 我怎么写这个()
- antlr4 - 以下规则集在 ANTLR 中是相互左递归的