How can an iFrame that has content, have an undefined contentDocument object?

亡梦爱人 提交于 2020-01-07 02:13:07

问题


I've been trying to develop a browser extension that needs to inject event handlers into all iFrames on a page. I have found that some iFrames, like those used for the Disqus commenting system, have content but no contentDocument.

How is this possible, and how can I access the event handlers for an iframe without a contentDocument?

Check out the comment section at the bottom of this page for an example. If you inspect the comment text area, you will see it is in an iFrame that has no contentDocument.


回答1:


This is caused by Same-Origin policy



来源:https://stackoverflow.com/questions/9451194/how-can-an-iframe-that-has-content-have-an-undefined-contentdocument-object

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