--- title: 'CSP: frame-src' slug: Web/HTTP/Headers/Content-Security-Policy/frame-src tags: - CSP - Content-Security-Policy - Directive - Frame - HTTP - Reference - Security - frame-src - source - セキュリティ - ディレクティブ - フレーム translation_of: Web/HTTP/Headers/Content-Security-Policy/frame-src ---
{{HTTPSidebar}}

HTTP の {{HTTPHeader("Content-Security-Policy")}} (CSP) における frame-src ディレクティブは、 {{HTMLElement("frame")}} や {{HTMLElement("iframe")}} のような要素を使用した内部の閲覧コンテキストの読み込みに有効なソースを指定します。

CSP バージョン 1
ディレクティブ種別 {{Glossary("Fetch directive", "フェッチディレクティブ")}}
代替 このディレクティブがない場合、ユーザーエージェントは {{CSP("child-src")}} ディレクティブを探す (さらにこの代替は {{CSP("default-src")}} ディレクティブである)。

構文

frame-src ポリシーには、1つ以上のソースが許可されています。

Content-Security-Policy: frame-src <source>;
Content-Security-Policy: frame-src <source> <source>;

ソース

{{page("/ja/docs/Web/HTTP/Headers/Content-Security-Policy/connect-src", "Sources")}}

違反例

この CSP ヘッダーがある場合、

Content-Security-Policy: frame-src https://example.com/

以下の {{HTMLElement("iframe")}} はブロックされ、読み込まれません。

<iframe src="https://not-example.com/"></iframe>

仕様書

仕様書 状態 備考
{{specName("CSP 3.0", "#directive-frame-src", "frame-src")}} {{Spec2('CSP 3.0')}} frame-src の非推奨化を解除
{{specName("CSP 1.1", "#directive-frame-src", "frame-src")}} {{Spec2('CSP 1.1')}} frame-src を非推奨化

ブラウザーの互換性

{{Compat("http.headers.csp.Content-Security-Policy.frame-src")}}

関連情報