// Check for browser errors after they occurred using Performance API
function checkForFrameErrors() {
// Method 1: Check Performance API for failed resources
try {
const entries = performance.getEntriesByType('navigation');
// Check for any security-related failures
// Method 2: Check if there are any console errors in the page
// This is more reliable than trying to intercept them
const errors = [];
// Override console to collect errors that have already happened
const originalError = console.error;
console.error = function(...args) {
const message = args.join(' ');
if (message.includes('Refused to display') &&
message.includes('frame') &&
message.includes('X-Frame-Options')) {
console.log('🚫 Found existing X-Frame-Options error in console');
return true;
}
originalError.apply(console, args);
return false;
};
return false;
} catch (e) {
return false;
}
}
// Global flag to track X-Frame-Options errors
window.xFrameOptionsBlocked = false;