2012-06-26 59 views

回答

3
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>