Skip to content

Commit

Permalink
Alert on attempt to use Topics API
Browse files Browse the repository at this point in the history
As multiple third-party scripts might be added to a site during
development, it can be difficult to see when a script is
attempting to use new browser features that might have privacy
consequences.

Consider adding a simple alert so that scripts can be checked and/or
the site Permissions-Policy set before deploying to production.

The "alert" is for development purposes, and could be replaced with
an analytics event if a site wants to monitor attempted use of
Topics API by third parties in production.

Related: h5bp#2459
  • Loading branch information
dmarti committed May 5, 2022
1 parent 5382f78 commit b3e9c04
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/html.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ potential
[encoding-related security issue](https://code.google.com/archive/p/doctype-mirror/wikis/ArticleUtf7.wiki)
in Internet Explorer.

### document.browsingTopics alert

In some cases, a third-party script can collect browsing interest information about users
using new experimental functionality called Topics API. The first script in the page header
will alert you if a script is attempting to do this. The line can be removed if your site
is turning off Topics API with a Permissions-Policy, running without third-party scripts,
or if you are using Topics API.

The line can be changed to send an analytics event to check if third-party scripts begin trying
to use Topics API in production.

For more information, see [Google's Topics API: Rebranding FLoC Without Addressing Key
Privacy Issues](https://brave.com/web-standards-at-brave/7-googles-topics-api/)

### Meta Description

The `description` meta tag provides a short description of the page. In some
Expand Down
1 change: 1 addition & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<head>
<meta charset="utf-8">
<script>document.browsingTopics=()=>{alert('Topics API called: check third-party scripts.'}</script>
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand Down

0 comments on commit b3e9c04

Please sign in to comment.