Web/API/XRSession/end event

From Get docs


An end event is fired at an XRSession object when the WebXR session has ended, either because the web application has chosen to stop the session, or because the user agent terminated the session.

Bubbles No
Cancelable No
Interface XRSessionEvent
Event handler XRSession.onend

Example

To be informed when a WebXR session comes to an end, you can add a handler to your XRSession instance using addEventListener(), like this:

XRSession.addEventListener("end", function(event) {
  /* the session has shut down */
});

Alternatively, you can use the XRSession.onend event handler property to establish a handler for the end event:

XRSession.onend = function(event) {
 /* the session has shut down */
}

Specifications

Specification Status Comment
WebXR Device APIThe definition of 'end event' in that specification. Working Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
end event Chrome

Full support 79

Edge

Full support 79

Firefox

No support No

IE

No support No

Opera

No support No

Safari

No support No

WebView Android

No support No

Chrome Android

Full support 79

Firefox Android

No support No

Opera Android

No support No

Safari iOS

No support No

Samsung Internet Android

Full support 11.2

Legend

Full support  
Full support
No support  
No support