Browse Source

VRButton: test navigator for SSR (#26915)

Cody Bennett 1 year ago
parent
commit
5ef9a2bd25
1 changed files with 1 additions and 1 deletions
  1. 1 1
      examples/jsm/webxr/VRButton.js

+ 1 - 1
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.