From ad7871febaa5c43c65eb86670a51a879282debfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Tue, 25 Jul 2023 17:12:22 +0200 Subject: [PATCH] Fix caml_js_on_ie Recent versions of node define `navigator` but not `navigator.userAgent`. --- CHANGES.md | 4 ++++ runtime/jslib_js_of_ocaml.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index f4df7f7a30..8826a18745 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +# Dev (2023-??-??) - ?? + +* Runtime: fix Dom_html.onIE (#1493) + # 5.4.0 (2023-07-06) - Lille ## Bug fixes diff --git a/runtime/jslib_js_of_ocaml.js b/runtime/jslib_js_of_ocaml.js index a5e2fa565b..fa88452927 100644 --- a/runtime/jslib_js_of_ocaml.js +++ b/runtime/jslib_js_of_ocaml.js @@ -22,7 +22,8 @@ //Provides: caml_js_on_ie const function caml_js_on_ie () { var ua = - globalThis.navigator?globalThis.navigator.userAgent:""; + (globalThis.navigator&&globalThis.navigator.userAgent) + ?globalThis.navigator.userAgent:""; return ua.indexOf("MSIE") != -1 && ua.indexOf("Opera") != 0; }