views:

79

answers:

2

Hello!

I have an iframe that is being loaded into external sites of which I cannot put any code in. What I would like to be able to determine from within my iframe (different domain) is if the iframe is currently within the 'viewport' of the browser (or if it is scrolled off the page).

Is there any way for this to be done? As I do not believe that I can access the scrolltop and viewport height properties of the parent page (due to cross domain), unless I am mistaken.

Thanks

+1  A: 

Somebody asked exactly the same question recently.

Pekka
Sorry I did not see that!
Adam Heath
+1  A: 

No, it can not be done because you can not access the document of the parent domain. That's needed to determine the position of the iframe element. You can get the size of the users screen, but that's about it. Your iframe could be invisible and you would have no way to tell. Sorry!

Josh Stodola
Sadly I now agree with you, thanks for confirming I had not missed anything in my search
Adam Heath