From 5ef9a2bd259a1f42d1d6df72b876180547c20f2b Mon Sep 17 00:00:00 2001 From: Cody Bennett Date: Mon, 9 Oct 2023 03:38:15 -0500 Subject: [PATCH] VRButton: test navigator for SSR (#26915) --- examples/jsm/webxr/VRButton.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/jsm/webxr/VRButton.js b/examples/jsm/webxr/VRButton.js index 6856a21b17aa45..81a67f06d172ed 100644 --- a/examples/jsm/webxr/VRButton.js +++ b/examples/jsm/webxr/VRButton.js @@ -176,7 +176,7 @@ class VRButton { static registerSessionGrantedListener() { - if ( 'xr' in navigator ) { + if ( typeof navigator !== 'undefined' && 'xr' in navigator ) { // WebXRViewer (based on Firefox) has a bug where addEventListener // throws a silent exception and aborts execution entirely.