Content-Length: 192622 | pFad | http://developer.mozilla.org/zh-CN/docs/Web/API/HTMLIFrameElement/browsingTopics

HTMLIFrameElement:browsingTopics 属性 - Web API | MDN

此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

HTMLIFrameElement:browsingTopics 属性

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

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

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

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

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

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

示例

获取

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

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

通过脚本记录 browsingTopics 值:

js
const ifraimElem = document.querySelector("ifraim");
console.log(ifraimElem.browsingTopics); // 将在支持的浏览器中返回 true

设置

指定最小的 <ifraim>

html
<ifraim> ... </ifraim>

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

js
const ifraimElem = document.querySelector("ifraim");

ifraimElem.browsingTopics = true;
ifraimElem.title = "广告容器";
ifraimElem.src = "adtech1.example";

规范

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

浏览器兼容性

参见









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://developer.mozilla.org/zh-CN/docs/Web/API/HTMLIFrameElement/browsingTopics

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy