0

I'm working on detecting whether my content is outside the iframe or not. I've been trying a straight forward case, but still not able to detect, basically I'm padding the iframe such that the document inside iFrame goes outside it's body.

I somehow need my document to say "hey I'm outside the iframe's viewport".

Have tried using clientHeight, BoundingClientRect(), visibilityState of document, but nothing seems to work. Adding a example:

<html>
<head></head>
<body>
<b>iframe-4 includes the ad-iframe</b>
<iframe style="overflow:hidden; height:400px; width:400px; padding-left:700px; padding-top:750px" src="simpleHtmlDocWithoutAnyFancyStuff.html" scrolling="no">
</body>
</html>
RightMan
  • 31
  • 3

1 Answers1

0

What your looking for is the Intersection API.

David Bradshaw
  • 11,859
  • 3
  • 41
  • 70