这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
InterventionReportBody
接口在
Reporting API
represents the body of an intervention report (the return value of its
Report.body
特性)。
An intervention report is generated when usage of a feature in a web document has been blocked by the browser for reasons such as security, performance, or user annoyance. So for example, a script was been stopped because it was significantly slowing down the browser, or the browser's autoplay policy blocked audio from playing without a user gesture to trigger it.
id
A string representing the intervention that generated the report. This can be used to group reports by deprecated feature.
message
A string containing a human-readable description of the intervention, including information such how the intervention could be avoided. This typically matches the message a browser will display in its DevTools console when an intervention is imposed, if one is available.
sourceFile
null
否则。
lineNumber
null
否则。
columnNumber
null
否则。
let options = {
types: ['intervention'],
buffered: true
}
let observer = new ReportingObserver(function(reports, observer) {
let firstReport = reports[0];
console.log(firstReport.type); // intervention
console.log(firstReport.body.id);
console.log(firstReport.body.message);
console.log(firstReport.body.sourceFile);
console.log(firstReport.body.lineNumber);
console.log(firstReport.body.columnNumber);
}, options);
| 规范 | 状态 | 注释 |
|---|---|---|
|
Reporting API
The definition of 'InterventionReportBody' in that specification. |
编者草案 |
No compatibility data found. Please contribute data for "api.DeprecationReportBody" (depth: 1) to the MDN 兼容性数据存储库 .