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 Reporting-Endpoints response header:
Reporting-Endpoints: default="https://jock.has.report/report"
default: the name of the endpoint, intervention reports are always delivered to the endpoint nameddefault"url": where to send reports, must behttps://, otherwise the endpoint will be ignored-
You may provide multiple
name="url"endpoints separated by comma (,)- For example:
Reporting-Endpoints: csp-reporting="https://example.com/csp", nel-reporting="https://example.com/nel"
- For example:
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 (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)
- Intervention Reporting Draft Community Group Report