Is there any JavaScript event triggered when the user enters VR mode while viewing the VR scene on a webpage?
Or is there any function which returns whether the user is viewing the webpage in VR mode or not?
Use the enter-vr
and exit-vr
events:
https://aframe.io/docs/0.5.0/core/scene.html#events
document.querySelector('a-scene').addEventListener('enter-vr', function () {
console.log("ENTERED VR");
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With