repo: janusweb
action: commit
revision: 
path_from: 
revision_from: d318d44675c0b406478ade6e2894f76bb5e89bd0:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit d318d44675c0b406478ade6e2894f76bb5e89bd0
Author: James Baicoianu 
Date:   Tue Jul 13 16:19:34 2021 -0700

    Check for navigator.xr before setting up sessiongranted event

diff --git a/scripts/client.js b/scripts/client.js
index 2aefc39c7d3e6bb411d652905742f9e533d49dc2..
index ..4883bffe0381d72e8c1b837c7ecee4e8659e4e52 100644
--- a/scripts/client.js
+++ b/scripts/client.js
@@ -104,9 +104,11 @@ elation.require(['engine.engine', 'engine.assets', 'engine.things.light_ambient'
       this.enginecfg.picking = true;
       this.enginecfg.useWebVRPolyfill = elation.utils.any(this.args.useWebVRPolyfill, true);

-      navigator.xr.addEventListener('sessiongranted', (ev) => {
-        this.startXR();
-      });
+      if ('xr' in navigator) {
+        navigator.xr.addEventListener('sessiongranted', (ev) => {
+          this.startXR();
+        });
+      }
     }
     this.initButtons = function() {
       this.sharebutton = elation.ui.button({classname: 'janusweb_sharing', label: 'Share'});

-----END OF PAGE-----