you can try this. Let me know how it works.
var myIframe = document.getElementById('myIframeId');
var myIframeWin = myIframe.contentWindow || myIframe.contentDocument;
if( !myIframeWin.document ) {
myIframeWin = myIframeWin.getParentNode();
}
source
share