allow writing into current document if prebid is loaded inside an iframe#1066
allow writing into current document if prebid is loaded inside an iframe#1066mkendall07 merged 4 commits intoprebid:masterfrom surensilva:master
Conversation
|
This is a great catch, thank you! |
src/prebid.js
Outdated
| var ad = adObject.ad; | ||
|
|
||
| if (doc === document || adObject.mediaType === 'video') { | ||
| if (!utils.inIframe() || adObject.mediaType === 'video') { |
There was a problem hiding this comment.
Unfortunately this logic is wrong, it fails for the standard prebid case (always evaluates to true when not in an iframe).
There was a problem hiding this comment.
Yes you are correct, this breaks my test page; we should have tested that.
mkendall07
left a comment
There was a problem hiding this comment.
Please fix for non-iframe case
| return JSON.parse(JSON.stringify(obj)); | ||
| } | ||
|
|
||
| export function inIframe() { |
There was a problem hiding this comment.
I think the problem here is we need to check a passed in window param, which we don't have. I think we have to change the renderAd API to accept the window instead of doc :(
There was a problem hiding this comment.
Hmm; I would hate to break backwards compatibility. Suren and I will brainstorm some techniques to see if we can come up with a backwards compatible solution that still solves this problem, and if so we'll update the pull-request. Thanks!
|
@mkendall07 updated this to be more specific for our case so it doesn't break the general Prebid.js case. Also updated |
|
@prebid/core can we get another review on this to see if it's good to go? We'd like to merge this sooner than later. Thanks! |
|
LGTM |
…built * 'master' of https://github.com/prebid/Prebid.js: (38 commits) Add optional domain parameter to AdButler adapter (prebid#1078) Send transactionID to Criteo Services (prebid#1113) Fix `buildMasterVideoTagFromAdserverTag()` not selecting winning bid (prebid#1106) Remove placement size selection and filtering (prebid#1107) revert `srcdoc` change (prebid#1130) Add new Adapter- Beachfront Media (prebid#1062) Fixes SpringServe adapter (prebid#1101) Update Widespace request param (prebid#1098) - New Adapter: Innity (prebid#1074) Update Roxot prebid analytic adapter (prebid#1034) Yarn Package Manager (prebid#1109) allow writing into current document if prebid is loaded inside an iframe (prebid#1066) Adapter bug fix (prebid#1096) fix typo added pr review process and governance model (prebid#1103) added support for sampling in ga and base adapter, fixed up some tests (prebid#1011) Add Inneractive adapter (prebid#1048) Add alias freewheel-ssp to stickyadstv bidder adapter (prebid#1043) Add Facebook Audience Network adapter (prebid#1068) Add Atomx support (prebid#1056) ...
Type of change
Description of change
For PostBid implementations, the secondary iframe ('postbid_if') where the ad is inserted into can cause view-ability metrics to drop. This enhancement allows the passing of the current document to the renderAd provided that prebid is loaded inside an iframe.
Updated PostBid Example: https://gist.github.com/surensilva/bdeec34abf1027acd8a87eb48a79f144