function receiveMessage(event) { if (typeof event.data !== 'string') { return; } var message = event.data.split(':'); var eventName = message[0]; var iframes, len, i = 0; // only receive messages from this domain var senderDomains = ['https://cdn.bestatterwebtool.de'];
if (senderDomains.indexOf(event.origin) !== -1 && eventName === 'resize') { iframes = document.getElementsByTagName('iframe'); len = iframes.length; for (; i < len; i++) { if ((iframes[i].contentWindow || iframes[i].documentWindow) == event.source) { iframes[i].style.height = (parseInt(message[1]) + 10) + "px"; return; } } } } if (window.addEventListener) { window.addEventListener('message', receiveMessage, false); } else if (window.attachEvent) { window.attachEvent('onmessage', receiveMessage); }