1

https://angular.io/guide/security#xssを参照し、イントラネットの SharePoint サイトの PDF を Web ページに表示しようとしました。

テンプレートは次のとおりです: 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 を追加してみました: 「X-Frame-Options」を「sameorigin」に設定したため、フレームに表示することを拒否する方法を修正する方法

しかし、それもうまくいきませんでした。ガイドしてください

4

0 に答える 0