// Get the iframe element const iframe = document.querySelector('iframe'); // Listen for the message event from the iframe window.addEventListener('message', event => { // Check that the message is coming from the iframe and has a valid height value if (event.source === iframe.contentWindow && event.data.hasOwnProperty('height')) { // Set the height of the iframe to the height value in the message iframe.style.height = `${event.data.height}px`; } }); // Set the src attribute of the iframe to the desired URL iframe.src = 'https://restoredtemecula.churchcenter.com/calendar?embed=true&view=list&allowFiltering=true&category=207354';