HTMLIFrameElement: browsingTopics プロパティ

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

非標準: この機能は標準ではなく、標準化の予定もありません。公開されているウェブサイトには使用しないでください。ユーザーによっては使用できないことがあります。実装ごとに大きな差があることもあり、将来は振る舞いが変わるかもしれません。

警告: この機能は現在、2 つのブラウザーベンダーから反対されています。反対の詳細については、標準の位置づけの節をご覧ください。

browsingTopicsHTMLIFrameElement インターフェイスのプロパティで、関連付けられた <iframe> のソースに対するリクエストとともに、現在のユーザーが選択したトピックを Sec-Browsing-Topics ヘッダーで送信すべきであることを指定する論理値です。これは、HTML の browsingtopics 属性を反映しています。

詳しくはトピック API の使用を参照してください。

論理値。既定値は false です。関連付けられた <iframe> のソースリクエストを、現在のユーザーが選択したトピックを含む Sec-Browsing-Topics ヘッダーとともに送信するには、これを true に設定します。

取得

browsingtopicstrue に設定し、宣言的に <iframe> コンテンツを読み込みます。

html
<iframe browsingtopics title="Advertising container" src="adtech1.example">
  ...
</iframe>

スクリプトを使用して browsingTopics の値をログ出力します。

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

設定

最小限の <iframe> を指定します。

html
<iframe> ... </iframe>

browsingtopicstrue に設定し、スクリプト経由で <iframe> コンテンツを読み込みます。

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

iframeElem.browsingTopics = true;
iframeElem.title = "Advertising container";
iframeElem.src = "adtech1.example";

仕様書

この機能は公式標準の一部ではありませんが、トピック API 非公式提案草案で定義されています。

ブラウザーの互換性

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
browsingTopics
ExperimentalNon-standard

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.
Non-standard. Check cross-browser support before using.

関連情報