HTMLIFrameElement: credentialless プロパティ

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。

credentiallessHTMLIFrameElement インターフェイスのプロパティで、この <iframe> が無信頼であるどうか、すなわち内部の文書が新しい、一時的なコンテキストで読み込まれることを意味します。

これらのコンテキストは、そのオリジンに関連付けられたネットワーク、クッキー、ストレージデータにアクセスすることはできません。最上位の文書が変わるごとに新しくなります。つまり、格納されたデータは、ユーザーがページから離れたり、再読み込みしたりすると、アクセスできなくなります。

その代わりに Cross-Origin-Embedder-Policy (COEP) の埋め込みルールを解除することができ、COEP を設定した文書でも、そうでないサードパーティの文書を埋め込むことができます。

論理値です。既定値は false です。<iframe> を信用させないようにするには true に設定してください。

取得

次のようにして視覚情報のない <iframe> を指定します。

html
<iframe
  src="https://en.wikipedia.org/wiki/Spectre_(security_vulnerability)"
  title="Spectre vulnerability Wikipedia page"
  width="960"
  height="600"
  credentialless></iframe>

credentialless プロパティの値を返します。

js
const iframeElem = document.querySelector("iframe");
console.log(iframeElem.credentialless); // 対応しているブラウザーでは true が返る

設定

こちらでは、HTML では詳細を最小限に設定します。

html
<iframe width="960" height="600"> </iframe>

<iframe> の中身を読み込む際に、スクリプトから credentiallesstrue に設定します。

js
const iframeElem = document.querySelector("iframe");

iframeElem.credentialless = true;
iframeElem.title = "Spectre vulnerability Wikipedia page";
iframeElem.src =
  "https://en.wikipedia.org/wiki/Spectre_(security_vulnerability)";

仕様書

Specification
Iframe credentialless
# dom-htmliframeelement-credentialless

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
credentialless
Experimental

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.

関連情報