Listener on the site that contains the <iframe> element
function(p, d) {
p = window.addEventListener ? "addEventListener" : "attachEvent";
d = function(e) {
if (e.origin !== "http://www.checktheorigin.com") return;
if (typeof e.data === 'object') {
document.getElementById(e.data.frame).style.height = e.data.height + 'px'
}
};
window[p]((window[p] == "attachEvent" ? "onmessage" : "message"), d, false)
})();
Message sender embedded on the page that renders the content for the iframe
(function(s, p, e, n, d, h, q) {
d = document;
s = d.querySelectorAll("label");
p = s.length;
while (p--) {
e = s.item(p);
n = e.textContent;
e.parentNode.classList.contains("required") && (n += "*");
e.nextElementSibling.setAttribute("placeholder", n)
}
h = (function() {
if (parent.postMessage) {
parent.postMessage( {
height: document.getElementById('content').offsetHeight, frame: window.name
}, '*')
}
})();
})()