1370072.html (607B)
1 <script> 2 let nLoads = 0; 3 4 function start() { 5 ifr = document.createElement('iframe'); 6 ifr.addEventListener('load', onLoad); 7 document.body.appendChild(ifr); 8 } 9 10 function onLoad() { 11 if (++nLoads > 3) { 12 // Limit recursion depth, bug 1971796 13 return; 14 } 15 doc = ifr.contentDocument; 16 // el will be body 17 el = function() { 18 let elements = doc.querySelectorAll('*:not([id])'); 19 return elements[elements.length-1] 20 }(); 21 ifr.contentWindow.onresize = onResize; 22 ifr.height = '5px'; 23 el.clientTop; 24 } 25 26 function onResize() { 27 document.documentElement.appendChild(ifr); 28 } 29 </script> 30 <body onload="start()"></body>