demo · v138
Crash report context: isTopLevel & visibilityState
A live ReportingObserver wired up to "crash". Toggle visibility, embed this page in itself, click "simulate" to see the shape of the report — including the new isTopLevel flag (top-level frame vs iframe) and visibilityState at the moment of the crash.
checking support…
Current top frame
document.visibilityState—
isTopLevel (would-be)—
document.hasFocus()—
URL—
Embedded iframe (will report as not top-level)
simulated crash reports captured
No reports yet. Click "Simulate" above.
the code
const observer = new ReportingObserver((reports) => {
for (const r of reports) {
if (r.type !== "crash") continue;
console.log({
reason: r.body.reason,
isTopLevel: r.body.isTopLevel, // NEW in 138
visibilityState: r.body.visibilityState, // NEW in 138
});
}
});
observer.observe();