Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function fieldBase () {}
fieldBase.getParentIframe = function () {
var iframes = window.parent.document.getElementsByTagName('iframe');
var parent;
Array.prototype.forEach.call(iframes, function (el, i) {
if (fieldBase.getIframeDocument(el) === window.document) {
parent = el;
return;
}
});
return parent;
};
fieldBase.getIframeDocument = function (iframe) {
return iframe.contentDocument || iframe.contentWindow.document;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment