aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-03-01 22:13:59 +0000
committerBen Harris <bjh21@bjh21.me.uk>2023-03-01 22:17:16 +0000
commitc0f715fbaca77fbb6e86de604098d82687bdea48 (patch)
tree8b87dc2bd808292252d17268b0e379e7adc4316b
parent5a74693b329eadb69153b150754eb099a0c87e9a (diff)
downloadpuzzles-c0f715fbaca77fbb6e86de604098d82687bdea48.zip
puzzles-c0f715fbaca77fbb6e86de604098d82687bdea48.tar.gz
puzzles-c0f715fbaca77fbb6e86de604098d82687bdea48.tar.bz2
puzzles-c0f715fbaca77fbb6e86de604098d82687bdea48.tar.xz
KaiOS: be more cautious about determining whether KaiAds is present
Just checking for the getKaiAd() function by doing "if (!getKaiAd ..." throws a ReferenceError if it's not defined, and now my error box catches that. Using "if (getKaiAd === undefined ..." seems to be acceptable, though.
-rw-r--r--kaios/kaiads-glue.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/kaios/kaiads-glue.js b/kaios/kaiads-glue.js
index 8614e24..62634b2 100644
--- a/kaios/kaiads-glue.js
+++ b/kaios/kaiads-glue.js
@@ -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 || !navigator.mozApps ||
+ if (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");