访问父节点.iframe内的文档

access to parent.document inside iframe

本文关键字:文档 iframe 父节点 访问      更新时间:2023-09-26

在iframe应用程序中,如果我们调用" parent.document ",我们将得到" Permission denied to access property 'document' "错误。当域不同时,似乎没有办法在iframe父文档中进行更改。

我已经追踪到facebook "FB "了。Ui"函数结果例如:

FB.ui({
    method: 'stream.share',
    u: 'www.example.com'
});

,发现在iframe中调用这个函数后,结果对话框只是一个< div >标签,它是在"父"中动态创建的。文档"页面。

所以如果访问父。文件是禁止iframe的,那么facebook怎么可能做这样的事情?

try:

pNode = document.getElementById(thisNode).parentNode