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')