Does anyone know of a good solution to suppress the warning messages that are shown in the Chrome dev tool console "Unsafe JavaScript attempt to access frame with URL" that happens when trying to access frames from a different domain?
Right now, I have a function that checks if the window is accessible. Every time this function is executed on a window object from a different domain, a warning message will get displayed in the Chrome Dev tools console. This happens quite frequently and the console becomes polluted with all these warnings, making hard to spot real JS errors.
I was thinking maybe there's a way to suppress these warnings in the console? Or better, is there a better way to write code to check if a window is accessible or not?
Here's what I do:
function isWindowAccessible(win) {
var accessible = null;
try {
accessible = win.location.href;
} catch (e) {}
return (typeof accessible === 'string');
}