Intervention reports
Intervention reports indicate that a browser has decided to not do what the server asked it to do for security, performance or user annoyance reasons. The browser may for example block phone vibration unless the user has already interacted with the page somehow.
The Report-To
response header:
Report-To: {"group":"default","max_age":1800,"endpoints":[{"url":"https://abner.has.report/report"}],"include_subdomains":true}
group
: the name of the group, can be used in a CSP header in thereport-to
directive, for examplemax_age
: how long the browser should use the endpoint and report errors to it-
endpoints
: reporting endpoint configuration, can specify multiple endpoints but reports will be sent to just one of themurl
: where to send reports to, must behttps://
, otherwise the endpoint will be ignored
Use an "intervened" feature
The mousewheel (in Chromium-based browsers) and touch (also in Firefox) event listeners that are registered on document level targets (e.g. window.document
or window
)
will be treated as passive (it has something to do with custom scrolling)
if not specified as otherwise and calling preventDefault()
inside such listeners will be ignored
<script>
document.getElementById('wheel').onclick = function() {
let sent = 0;
const handler = function (event) {
event.preventDefault();
console.log('Whee');
sent++;
if (sent === 3) {
window.removeEventListener('wheel', handler);
window.removeEventListener('touchstart', handler);
}
};
window.addEventListener('wheel', handler);
window.addEventListener('touchstart', handler);
alert('Wheel and touchstart handlers added, now scroll');
}
</script>
- Will trigger a report that will be sent asynchronously, possibly grouped with other reports (intervention visible in Developer Tools in the Console tab, you won't see the report in Network tab but you can still view the reporting requests)
- Check your reports (can take some time before the browser sends the report)
- Only three reports per page load will be sent in this demo to not spam you with identical reports, then the handlers will be automatically removed
See Chrome's incomplete list of interventions (the above-mentioned phone vibrate intervention is not included in this list for some reason).
Related specs & documents
- Reporting API Working Draft
- Reporting API Editor's Draft (which will evolve into a Working Draft, followed by a Recommendation eventually)
-
Notable changes in the Editor's Draft are switching to structured headers (
Reporting-Endpoints
instead ofReport-To
) and moving out concrete reports into the following separate Draft Community Group Reports: Crash Reporting, Deprecation Reporting, Intervention Reporting