Send message to parent frame with document height when embedded

This commit is contained in:
Skylar Ittner 2020-04-07 15:24:31 -06:00
parent c45e2b64c5
commit 52f01949d3

View File

@ -255,3 +255,16 @@ if (isset($_GET["backgroundcolor"]) && !empty($_GET["backgroundcolor"]) && preg_
</div>
</div>
</div>
<?php
// Send message to parent frame with our height so they can adjust the iframe
if (isset($_GET["embed"])) {
?>
<script nonce="<?php echo $SECURE_NONCE; ?>">
window.addEventListener("load", function () {
window.postMessage(document.documentElement.scrollHeight + "px", "*");
});
</script>
<?php
}
?>