The cause of this error showing up in the console in Webkit browsers is well-known and described clearly in the error text:
Unsafe JavaScript attempt to access frame with URL iframed-content-example.com from frame with URL www.example.com. Domains, protocols and ports must match.
But for large sites with many possible pieces of code triggering the error (ads, third-party libraries, site-specific scripts), the error message is not too helpful for tracking down and debugging the line of code that generated the issue. Is there any way to trigger a stack trace when the cross-domain error occurs?
This problem is tracked here: https://code.google.com/p/chromium/issues/detail?id=88885.
This particular error message shows stack trace in the most recent versions of Chromium.
I'm going to go ahead and answer my own question and say this is not currently possible. After checking the source and Chromium's issue tracker, it looks like the lack of stack trace stems from an upstream decision in Webkit to not throw an exception after an unsafe cross-frame access attempt. The decision to keep the error handling deliberately opaque was made based on a security rationale.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With