intersectionobserver_cross_domain_iframe.html (563B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <style> 5 #target5 { 6 position: absolute; 7 top: 0px; 8 left: 0px; 9 width: 20px; 10 height: 20px; 11 background: #f00; 12 } 13 </style> 14 <body> 15 <div id="target5"></div> 16 <script> 17 var io = new IntersectionObserver(function (records) { 18 console.log(records[0].rootBounds, location.href); 19 window.parent.postMessage(records[0].rootBounds == null, 'http://mochi.test:8888'); 20 }, {}); 21 io.observe(document.getElementById("target5")); 22 </script> 23 </body> 24 </html>