Window.onvrdisplaypresentchange

Nos bénévoles n'ont pas encore traduit cet article en Français. Inscrivez-vous et aidez-nous à réaliser cette tâche !
Vous pouvez également lire cet article en English (US).

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The onvrdisplaypresentchange property of the Window interface represents an event handler that will run when the presenting state of a VR display changes — i.e. goes from presenting to not presenting, or vice versa (when the vrdisplaypresentchange event fires).

The event object is of type VRDisplayEvent.

Syntax

window.onvrdisplaypresentchange = functionRef;

Examples

The presenting state of a VRDisplay can be checked using the VRDisplay.isPresenting property.

window.onvrdisplaypresentchange = function() {
  if(vrDisplay.isPresenting) {
    info.textContent = 'Display has started presenting.';
  } else {
    info.textContent = 'Display has stopped presenting.';
  }
};

Specifications

Specification Status Comment
WebVR 1.1
The definition of 'onvrdisplaypresentchange' in that specification.
Draft Initial definition

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support651 ?

634

555

No No No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support ?562 3 ?55 No No Yes6

1. From version 65: this feature is behind the WebVR preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.

2. Chrome for Android 56 supports only Google Daydream View.

3. Chrome for Android 57 adds support for Google Cardboard.

4. Only Windows and macOS support is enabled.

5. Only Windows support is enabled.

6. Supported on Samsung Internet for GearVR.

See also

Étiquettes et contributeurs liés au document

Contributeurs à cette page : wbamberg, chrisdavidmills, mattwojo
Dernière mise à jour par : wbamberg,