Explorar el Código

VRButton: test navigator for SSR (#26915)

Cody Bennett hace 1 año
padre
commit
5ef9a2bd25
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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.