-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS Referrer fix #996
iOS Referrer fix #996
Changes from 4 commits
6dd9c1e
6a41602
a95ab43
968591d
85f6f25
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ $$PREBID_GLOBAL$$.adUnits = $$PREBID_GLOBAL$$.adUnits || []; | |
|
||
/** | ||
* Command queue that functions will execute once prebid.js is loaded | ||
* @param {function} cmd Annoymous function to execute | ||
* @param {function} cmd Anonymous function to execute | ||
* @alias module:$$PREBID_GLOBAL$$.que.push | ||
*/ | ||
$$PREBID_GLOBAL$$.que.push = function (cmd) { | ||
|
@@ -133,6 +133,15 @@ function setRenderSize(doc, width, height) { | |
} | ||
} | ||
|
||
/** | ||
* Check if parent iframe of passed document supports content rendering via 'srcdoc' property | ||
* @param {HTMLDocument} doc document to check support of 'srcdoc' | ||
*/ | ||
function isSrcdocSupported(doc) { | ||
//Firefox is excluded due to https://bugzilla.mozilla.org/show_bug.cgi?id=1265961 | ||
return !!doc.defaultView && 'srcdoc' in doc.defaultView.frameElement && !/firefox/i.test(navigator.userAgent); | ||
} | ||
|
||
////////////////////////////////// | ||
// // | ||
// Start Public APIs // | ||
|
@@ -277,8 +286,9 @@ $$PREBID_GLOBAL$$.allBidsAvailable = function () { | |
}; | ||
|
||
/** | ||
* This function will render the ad (based on params) in the given iframe document passed through. Note that doc SHOULD NOT be the parent document page as we can't doc.write() asynchrounsly | ||
* @param {object} doc document | ||
* This function will render the ad (based on params) in the given iframe document passed through. | ||
* Note that doc SHOULD NOT be the parent document page as we can't doc.write() asynchronously | ||
* @param {HTMLDocument} doc document | ||
* @param {string} id bid id to locate the ad | ||
* @alias module:$$PREBID_GLOBAL$$.renderAd | ||
*/ | ||
|
@@ -299,15 +309,19 @@ $$PREBID_GLOBAL$$.renderAd = function (doc, id) { | |
var width = adObject.width; | ||
var url = adObject.adUrl; | ||
var ad = adObject.ad; | ||
|
||
if (doc===document || adObject.mediaType === 'video') { | ||
utils.logError('Error trying to write ad. Ad render call ad id ' + id + ' was prevented from writing to the main document.'); | ||
if (doc === document || adObject.mediaType === 'video') { | ||
utils.logError(`Error trying to write ad. Ad render call ad id ${id} was prevented from writing to the main document.`); | ||
} else if (ad) { | ||
doc.write(ad); | ||
doc.close(); | ||
if (isSrcdocSupported(doc)) { | ||
doc.defaultView.frameElement.srcdoc = ad; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ckbo3hrk fyi There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mkendall07, I'd like to investigate this bug. Could you please provide me a sample dfp tag to reproduce this issue ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ckbo3hrk |
||
} else { | ||
doc.write(ad); | ||
doc.close(); | ||
} | ||
setRenderSize(doc, width, height); | ||
} else if (url) { | ||
doc.write('<IFRAME SRC="' + url + '" FRAMEBORDER="0" SCROLLING="no" MARGINHEIGHT="0" MARGINWIDTH="0" TOPMARGIN="0" LEFTMARGIN="0" ALLOWTRANSPARENCY="true" WIDTH="' + width + '" HEIGHT="' + height + '"></IFRAME>'); | ||
doc.write(`<IFRAME SRC="${url}" FRAMEBORDER="0" SCROLLING="no" MARGINHEIGHT="0" MARGINWIDTH="0" TOPMARGIN="0" LEFTMARGIN="0" ALLOWTRANSPARENCY="true" WIDTH="${width}" HEIGHT="${height}"></IFRAME>`); | ||
doc.close(); | ||
setRenderSize(doc, width, height); | ||
} else { | ||
|
@@ -483,7 +497,7 @@ $$PREBID_GLOBAL$$.offEvent = function (event, handler, id) { | |
/** | ||
* Add a callback event | ||
* @param {String} eventStr event to attach callback to Options: "allRequestedBidsBack" | "adUnitBidsBack" | ||
* @param {Function} func function to execute. Paramaters passed into the function: (bidResObj), [adUnitCode]); | ||
* @param {Function} func function to execute. Parameters passed into the function: (bidResObj), [adUnitCode]); | ||
* @alias module:$$PREBID_GLOBAL$$.addCallback | ||
* @returns {String} id for callback | ||
*/ | ||
|
@@ -586,7 +600,7 @@ $$PREBID_GLOBAL$$.loadScript = function (tagSrc, callback, useCache) { | |
}; | ||
|
||
/** | ||
* Will enable sendinga prebid.js to data provider specified | ||
* Will enable sending a prebid.js to data provider specified | ||
* @param {object} config object {provider : 'string', options : {}} | ||
*/ | ||
$$PREBID_GLOBAL$$.enableAnalytics = function (config) { | ||
|
@@ -679,7 +693,7 @@ $$PREBID_GLOBAL$$.buildMasterVideoTagFromAdserverTag = function (adserverTag, op | |
|
||
/** | ||
* Set the order bidders are called in. If not set, the bidders are called in | ||
* the order they are defined wihin the adUnit.bids array | ||
* the order they are defined within the adUnit.bids array | ||
* @param {string} order - Order to call bidders in. Currently the only possible value | ||
* is 'random', which randomly shuffles the order | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you move into
utils.js
pleaseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done