WebVR example is not working both in my localhost and https website as well

I tried to integrate webVR in my three js scene just like in https://threejs.org/examples/webvr_cubes , I included both three.js and WebVR.js. The same code that works in the three js example doesnt work in my case because navigator.getVRDisplays is undefined in my case. One stackoverflow thread told that it doesn’t work on localhost since google serves VR only for https sites, so I tried the code in my https site, and its still the same. Does anyone know why this happens?

https://threejs.org/ uses an origin trials token to enable WebVR on mobile Chrome browsers. The token is embedded in the website as a meta tag.

Instead of using such a token, you can enable WebVR in your Chrome via chrome://flags/.

image

2 Likes

Thanks a lot!, it worked