Unable to access contents of a safeframe returned

2019-07-24 21:34发布

  1. I work in adtech company and have a problem when i try and access an safeframe returned by google adx

  2. I need to get a href or img inside the safeframe to check if ad is coming or not as if to find if anything is coming or no ad is being sent.

  3. When i try and access the contents of the safeframe I get error:-

Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://www.somerandomname.com" from accessing a cross-origin frame.

What should i do in this case as finding out if no ad or ad is returning is important in business sense.

1条回答
混吃等死
2楼-- · 2019-07-24 22:08

That's not possible, because of iframe content is on different domain.

But DFP is smart enought. When you have ADX intergrated in your DFP, you can create conditions, that will prioritise ADX ads here:

enter image description here

More about it here: https://support.google.com/adxseller/answer/6300696?hl=en https://support.google.com/adxseller/topic/3376095?hl=en&ref_topic=2911899

查看更多
登录 后发表回答