Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何检查一个iframe是否存在于另一个iframe中?_Javascript_Html_Jquery_Iframe - Fatal编程技术网

Javascript 如何检查一个iframe是否存在于另一个iframe中?

Javascript 如何检查一个iframe是否存在于另一个iframe中?,javascript,html,jquery,iframe,Javascript,Html,Jquery,Iframe,我在另一个iframe中加载了一个iframe。所以基本上我会有一个这样的结构 Parent window Iframe Iframe 我正在第二个iframe中加载一个pdf,它以前在第一个iframe中 以前我使用的是一个代码 var iFrame = document.getElementById('firstIframe'); console.log(iFrame.contentDocument);return; if ( iFrame.contentDocu

我在另一个
iframe
中加载了一个
iframe
。所以基本上我会有一个这样的结构

Parent window
    Iframe
        Iframe
我正在第二个iframe中加载一个pdf,它以前在第一个iframe中

以前我使用的是一个代码

var iFrame =  document.getElementById('firstIframe');
console.log(iFrame.contentDocument);return;
if ( iFrame.contentDocument ) {}
在这里,我可以从父窗口检查文档。有没有办法像这样检查父窗口中的第二个iframe

欢迎提供任何帮助

document.querySelector('firstIframe').contentDocument.querySelector('secondIframe')