Skip to content

Commit

Permalink
Fixing Adyoulike adapter for Safari iOS7 (prebid#1296)
Browse files Browse the repository at this point in the history
* Added a try/catch block around the troublesome code.

* Defaulted to false, to make the unit tests pass.
  • Loading branch information
dbemiller authored and dluxemburg committed Jul 17, 2018
1 parent 3a2ca5b commit fe41582
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/adapters/adyoulike.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,17 @@ var AdyoulikeAdapter = function AdyoulikeAdapter() {
Placements: placements,
};

if (performance && performance.navigation) {
body.PageRefreshed = performance.navigation.type === performance.navigation.TYPE_RELOAD;
// performance isn't supported by mobile safari iOS7. window.performance works, but
// evaluates to true on a unit test which expects false.
//
// try/catch was added to un-block the Prebid 0.25 release, but the adyoulike adapter
// maintainers should revisit this and see if it's really what they want.
try {
if (performance && performance.navigation) {
body.PageRefreshed = performance.navigation.type === performance.navigation.TYPE_RELOAD;
}
} catch (e) {
body.PageRefreshed = false;
}

return JSON.stringify(body);
Expand Down

0 comments on commit fe41582

Please sign in to comment.