coderef

TopicsLimited availability

The topics API reports a user's likely subject-matter interests (as determined by the browser, known as topics) to iframes. This allows for interest-based advertising that does not rely on user's exact browsing history, third-party cookies, or fingerprinting.

Not yet supported in all major browsers — check the table and provide a fallback.

Discouraged: Following the announcement that Chrome will maintain its current approach to third-party cookies, Chrome decided to withdraw certain Privacy Sandbox features including the topics API.

Browser support

DesktopChrome
✕Not supportedup to 155
Current: 155
Edge
✕Not supportedup to 154
Current: 154
Firefox
✕Not supportedup to 157
Current: 157
Safari
✕Not supportedup to 27
Current: 27
MobileChrome Android
✕Not supportedup to 155
Current: 155
Firefox Android
✕Not supportedup to 157
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Chrome, Edge, Firefox, Safari, Chrome Android, Firefox Android, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: browsingTopics.

Feature detection

JS · check before using
if ("Document" in globalThis && "browsingTopics" in Document.prototype) {
  // Document.browsingTopics is available
}

Sub-features

Support for each part of the feature (9). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
Document.browsingTopics✕✕✕✕✕✕✕
HTMLIFrameElement.browsingTopics✕✕✕✕✕✕✕
Request.Request.options_parameter.browsingTopics126126✕✕126✕✕
fetch.options_parameter.browsingTopics126126✕✕126✕✕
iframe.allow.browsing-topics115115✕✕115✕✕
iframe.browsingtopics126126✕✕126✕✕
http.headers.Observe-Browsing-Topics115115✕✕115✕✕
http.headers.Permissions-Policy.browsing-topics115115✕✕115✕✕
http.headers.Sec-Browsing-Topics115115✕✕115✕✕