GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

Window: vrdisplayactivate event

Window

Window

The **`vrdisplayactivate`** event of the [WebVR API](/docs/Web/API/WebVR_API) is fired when a VR display is able to be presented to, for example if an HMD has been moved to bring it out of standby, or woken up by being put on.

> [!NOTE]
> This event was part of the old [WebVR API](https://immersive-web.github.io/webvr/spec/1.1/). It has been superseded by the [WebXR Device API](https://immersive-web.github.io/webxr/).

This event is not cancelable and does not bubble.

## Syntax

Use the event name in addEventListener():

```js-nolint
addEventListener("vrdisplayactivate", (event) => { })
```

Alternatively, assign to the [event handler property](/docs/Web/API/Document_Object_Model/Events#using_onevent_properties) of the interface:

```js-nolint
onvrdisplayactivate = (event) => { }
```

## Event type

A VRDisplayEvent. Inherits from Event.

VRDisplayEvent

## Examples

You can use the `vrdisplayactivate` event in an [`addEventListener`](/docs/Web/API/EventTarget/addEventListener) method:

```js
window.addEventListener("vrdisplayactivate", () => {
info.textContent = "Display activated.";
reportDisplays();
});
```

Or use the `onvrdisplayactivate` event handler property (but note that this replaces other event listeners added using `onvrdisplayactivate`, if any):

```js
window.onvrdisplayactivate = () => {
info.textContent = "Display activated.";
reportDisplays();
};
```

## Specifications

This event was part of the old [WebVR API](https://immersive-web.github.io/webvr/spec/1.1/) that has been superseded by the [WebXR Device API](https://immersive-web.github.io/webxr/). It is no longer on track to becoming a standard.

Until all browsers have implemented the new [WebXR Device API](https://immersive-web.github.io/webxr/), it is recommended to rely on frameworks, like [A-Frame](https://aframe.io/), [Babylon.js](https://www.babylonjs.com/), or [Three.js](https://threejs.org/), or a [polyfill](https://github.com/immersive-web/webxr-polyfill), to develop WebXR applications that will work across all browsers. Read [Meta's Porting from WebVR to WebXR](https://developers.meta.com/vr/documentation/web/port-vr-xr/) guide for more information.

## Browser compatibility

## See also

- [WebVR API](/docs/Web/API/WebVR_API)

source: MDN Web Docs mirror · page

Cite this

"Window: vrdisplayactivate event". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/Window/vrdisplayactivate_event

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·