1. I'm making a PTC site, where users get paid by visiting sites for x seconds.
2. The ad view works like this: A new page is opened, containing two things, the top bar with the counter and the iframe which contains the advertiser's site).
3. I want to "force" the user to see that page for the x seconds that the advertiser paid for.
4. To check if the user is seeing the page, IMO, I need to check if either the document or iframe has focus.
Problems:
1. I can't use [login to view URL] or [login to view URL] since the user can lose focus before the page loads and bypass those commands.
2. I can't use hasFocus() on the iframe because Chrome throws this error: Blocked a frame with origin "xxx" from accessing a frame with origin "yyy". Protocols, domains, and ports must match.
I know two similar sites that accomplish this, but their javascript is so weird that I can't understand a single line. ([login to view URL] and [login to view URL])
So I need someone to do this for me.