Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. InterventionReportBody

InterventionReportBody

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Note: This feature is available inWeb Workers.

Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.

TheInterventionReportBody interface of theReporting API represents the body of an intervention report.

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.

A deprecation report is generated when a deprecated feature (for example a deprecated API method) is used on a document being observed by aReportingObserver. In addition to the support of this API, receiving useful intervention warnings relies on browser vendors adding these warnings for the relevant features.

Constructor

An instance ofInterventionReportBody is returned as the value ofReport.body whenReport.Type isintervention. The interface has no constructor.

Instance properties

This interface also inherits properties fromReportBody.

InterventionReportBody.idExperimentalRead only

A string representing the intervention that generated the report. This can be used to group reports.

InterventionReportBody.messageExperimentalRead only

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.

InterventionReportBody.sourceFileExperimentalRead only

A string containing the path to the source file where the intervention occurred, if known, ornull otherwise.

InterventionReportBody.lineNumberExperimentalRead only

A string representing the line in the source file in which the intervention occurred, if known, ornull otherwise.

InterventionReportBody.columnNumberExperimentalRead only

A string representing the column in the source file in which the intervention occurred, if known, ornull otherwise.

Instance methods

This interface also inherits methods fromReportBody.

InterventionReportBody.toJSON()Experimental

Aserializer which returns a JSON representation of theInterventionReportBody object.

Examples

In this example we create a newReportingObserver to observe intervention reports, then print details of each property of the first report to the console.

js
const options = {  types: ["intervention"],  buffered: true,};const observer = new ReportingObserver((reports, observer) => {  const 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);

Specifications

Specification
Intervention Reporting
# intervention-report

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp