Debugging “unsafe javascript attempt to access frame with URL … ”

試著忘記壹切 提交于 2020-01-02 15:40:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!