A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/zh-CN/docs/Web/API/HTMLIFrameElement/browsingTopics below:

HTMLIFrameElement:browsingTopics 属性 - Web API

HTMLIFrameElement:browsingTopics 属性

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格。

非标准: 该特性尚未标准化。我们不建议在生产环境中使用非标准特性,因为它们在浏览器中的支持有限,且可能发生变化或被移除。不过,在没有标准选项的特定情况下,它们可以作为合适的替代方案。

警告: 此特性目前遭到两家浏览器厂商反对。有关反对详情,请参阅标准立场部分。

HTMLIFrameElement 接口的 browsingTopics 属性是一个指定当前用户选择的主题应与之关联的 <iframe> 源请求一起以 Sec-Browsing-Topics 标头发送的布尔值。这反映了 browsingtopics HTML 属性。

有关更多详细信息,请参阅使用 Topics API。

值

一个布尔值,默认值为 false;将其设置为 true 可使与 <iframe> 相关联的源请求携带一个包含当前用户选定主题的 Sec-Browsing-Topics 标头。

示例 获取

将 browsingtopics 设置为 true,然后以声明方式加载 <iframe> 的内容:

<iframe browsingtopics title="广告容器" src="adtech1.example"> ... </iframe>

通过脚本记录 browsingTopics 值:

const iframeElem = document.querySelector("iframe");
console.log(iframeElem.browsingTopics); // 将在支持的浏览器中返回 true
设置

指定最小的 <iframe>:

将 browsingtopics 设置为 true,然后通过脚本加载 <iframe> 内容:

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

iframeElem.browsingTopics = true;
iframeElem.title = "广告容器";
iframeElem.src = "adtech1.example";
规范

此特性不属于官方标准,尽管它被定义在 Topics API 非官方建议草案中。

浏览器兼容性 参见

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4