mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-22 16:32:13 -07:00
KaiOS: be more careful detecting the presence of KaiAds
Now that we catch JavaScript errors and report them to the user, I could tell that the way we were detecting the presence of getKaiAd() didn't work because it caused an alert every time a build without KaiAds was started. Detecting the presence of a global variable is slightly tricky, but explicitly looking for it on "window" works and isn't very ugly.
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
(function() {
|
||||
// To run, we need to be on KaiOS with the KaiAds SDK and the
|
||||
// Open Web Apps API.
|
||||
if (getKaiAd === undefined || navigator.mozApps === undefined ||
|
||||
if (window.getKaiAd === undefined || navigator.mozApps === undefined ||
|
||||
navigator.userAgent.toLowerCase().indexOf('kaios') == -1) return;
|
||||
// If those prerequisites are satisfied, install the button.
|
||||
var advertbutton = document.createElement("button");
|
||||
|
Reference in New Issue
Block a user