Web VR

What is Web VR?

WebVR was an experimental JavaScript application programming interface (API) that enabled applications to interact with virtual reality devices, such as the HTC Vive, Oculus Rift, Google Cardboard or Open Source Virtual Reality (OSVR) in a web browser. It was implemented in Firefox and Chromium-based browsers before being deprecated and removed. The WebVR API was superseded by a more powerful WebXR API that is capable of representing virtual reality and augmented reality devices simultaneously.

This API is designed with the following goals in mind:

  • Detect available virtual reality devices.
  • Query the device’s capabilities.
  • Poll the device’s position and orientation.
  • Display imagery on the device at the appropriate frame rate.


The WebVR API exposes a few new interfaces (such as VR Display, VR pose) that allow web applications to present content in virtual reality, by using WebGL with the necessary camera settings and device interactions (such as controllers or point of view). The API has been designed to follow a certain path, which is very similar to other intrusive Web API like the Geolocation API. The necessary steps are:

  • Request a list of the available VR devices.
  • Check to see if the desired device supports the presentation modes the application needs.
  • If so, application advertises VR functionality to the user.
  • User performs an action that indicates they want to enter VR mode.
  • Request a VR session to present VR content with.
  • Begin a render loop that produces graphical frames to be displayed on the VR device.
  • Continue producing frames until the user indicates that they wish to exit VR mode.
  • End the VR session.