Debugging “unsafe javascript attempt to access fra

2019-05-22 01:57发布

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.

2条回答
孤傲高冷的网名
2楼-- · 2019-05-22 02:29

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';
查看更多
地球回转人心会变
3楼-- · 2019-05-22 02:47

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

查看更多
登录 后发表回答