问题
So, the error message is the security restriction to access a parent frame or window from within an (i)frame from a different domain.
(Unsafe javascript attempt to access frame with URL xxx from frame with URL yyy. Domains, protocols, and ports must match).
However, there is no line shown in webkit or chrome from where this error is generated.
So how do I get a list of the lines that infringe upon this? I know I can just search, but does this apply to cookies as well (document.cookie, etc) ? Is there a list of things that are disallowed?
Edit: Also, what do I need to use instead of $(window.top)?
Thanks.
回答1:
If you own all of the pages (the containing document and the iframe document) just stick some javascript in each of them to allow them to communicate happily:
document.domain = 'myDomain.com';
回答2:
Any call from inside the frame to window instead of window.frames[my frame] will cause a violation unless you have the document.domain set to match the parent. https://developer.mozilla.org/en/DOM/document.domain
来源:https://stackoverflow.com/questions/8069795/debugging-unsafe-javascript-attempt-to-access-frame-with-url