<!DOCTYPE html>
<div id="target" style="height: 100px; background-color: green;"></div>
<script>
const observer = new IntersectionObserver(records => {
  records.forEach(record => {
    if (record.isIntersecting) {
      window.top.postMessage(record.isIntersecting, "*");
    }
  });
}, {});
observer.observe(target);
window.addEventListener("load", () => {
  window.top.postMessage("ready", "*");
});
</script>
