有没有办法从FBJS中的画布访问iframe的窗口对象?(Facebook)的

the*_*art 3 javascript facebook fbml

从facebook画布,我需要能够访问iframe窗口.通常您可以使用window.frames执行此操作,但FJBS似乎不允许访问窗口对象.

有没有人想出如何访问窗口对象?

meo*_*ouw 10

你可以试试这个.让我知道它是如何工作的.

var myIframe = document.getElementById('myIframeId');

// could retrieve window or document depending on the browser
// (if FBJS allows it!?)
var myIframeWin = myIframe.contentWindow || myIframe.contentDocument;

if( !myIframeWin.document ) { //we've found the document
    myIframeWin = myIframeWin.getParentNode(); //FBJS version of parentNode
}
Run Code Online (Sandbox Code Playgroud)