admin管理员组

文章数量:1354764

Just as the question states, I have an iframe that is on a cross domain parent. I need to trigger an event if that content is scrolled into view or already in view on page load. Normal checks for distance from top/side of page and viewport height/width don't seem to work as they measure the page within the iframe itself.

I cannot edit/add anything on the parent page to enable this functionality, everything must be within the iframe itself.

The reason behind this is to record whether content has ever had the chance to be viewed by the user or if it was loaded out of view and kept there.

There are panies who provide this service for advertising, but as far as finding out how it is actually done, well it seems to be one of the dark arts.

Any help would be greatly appreciated.

EDIT: Two examples of the panies I spoke of who offer this service.

  1. View the first tick under (4) /
  2. First thing they state they can do on the right hand side .page

Just as the question states, I have an iframe that is on a cross domain parent. I need to trigger an event if that content is scrolled into view or already in view on page load. Normal checks for distance from top/side of page and viewport height/width don't seem to work as they measure the page within the iframe itself.

I cannot edit/add anything on the parent page to enable this functionality, everything must be within the iframe itself.

The reason behind this is to record whether content has ever had the chance to be viewed by the user or if it was loaded out of view and kept there.

There are panies who provide this service for advertising, but as far as finding out how it is actually done, well it seems to be one of the dark arts.

Any help would be greatly appreciated.

EDIT: Two examples of the panies I spoke of who offer this service.

  1. View the first tick under (4) http://www.doubleverify./what-is-verification/
  2. First thing they state they can do on the right hand side http://adxpose./home.page
Share Improve this question edited Apr 2, 2012 at 13:15 Vendrad asked Apr 2, 2012 at 13:03 VendradVendrad 811 silver badge4 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 5

spider.io does this probably using browser timing attacks. there is a video on their page:

http://www.spider.io/viewability/

here is a nice report on how some browser timing attacks work: http://www.contextis./documents/2/Browser_Timing_Attacks.pdf

Simple answer is, you can't.

You have no way to access a cross-domain iframe (DOM or window object) with ECMAscript because of the Same Origin Policy.

Are you sure those examples are exclusively iframe based? Maybe they need to add some javascript to the parent Window.

If you really need this, and 100% accuracy is not needed, I would try some time based techniques on the assumption that most browser will optimize graphical work happening out of view.

Being realistic I don't think it would be possible to get good results with that techniques in a reasonable time or expecting a general robust cross-browser solution. It would be quite fun though.

doubleverify and adxpose use "offline" techniques to determine if the ad was visible or not, it doesn't happen on the page view. If they did it through Javascript, all you would have to do is look at one of their pixels to see how it works.

本文标签: