Skip to content

Commit

Permalink
Log error when renderAd lookup failed (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sir-Will authored Sep 7, 2023
1 parent 5e8a24f commit 8cbe9b1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/renderingManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,23 @@ export function renderBannerOrDisplayAd(doc, dataObject) {
* @param {string} adId Id of creative to render
*/
export function renderLegacy(doc, adId) {
let found = false;
let w = window;
for (let i = 0; i < 10; i++) {
w = w.parent;
if (w.$$PREBID_GLOBAL$$) {
try {
found = true;
w.$$PREBID_GLOBAL$$.renderAd(doc, adId);
break;
} catch (e) {
continue;
}
}
}
if (!found) {
console.error("Unable to locate $$PREBID_GLOBAL$$.renderAd function!");
}
}

/**
Expand Down

0 comments on commit 8cbe9b1

Please sign in to comment.