1
里面我想检查,看是否有DOM节点是在我的应用程序在iFrame中。无论如何找到节点所在的窗口?检查,看是否有DOM节点是Iframe
里面我想检查,看是否有DOM节点是在我的应用程序在iFrame中。无论如何找到节点所在的窗口?检查,看是否有DOM节点是Iframe
if (node.ownerDocument.defaultView.frameElement)
// We're inside of an <iframe>
Explantions到的代码:
node.ownerDocument.defaultView.frameElement
// ^------------------------------------------ The document of the <iframe>.
// ^--------------------------- The window of the <iframe>
// ^---------------- The <iframe>