问题
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