Skip to content Skip to sidebar Skip to footer

Is There A Way To Access An Iframe's Window Object From The Canvas In Fbjs? (facebook)

From the facebook canvas, I need to be able to access an iframe window. Normally you could do this with window.frames, but FJBS doesn't seem to allow access to the window object.

Solution 1:

you could try this. Let me know how it works.

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
}

Solution 2:

Browsers handle domain security on the principle of Same Origin Policy

And the laws of cross domain communication

Also you will find an interesting read on the creationg of read-write JS APIs on this blog post http://piecesofrakesh.blogspot.com/2007/11/how-to-build-readwrite-javascript-api.html

Post a Comment for "Is There A Way To Access An Iframe's Window Object From The Canvas In Fbjs? (facebook)"