XRSession: end event

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

A end event is fired on XRSession interface when the XR session is ended, either by application or User Agent.

It's a XRSessionEvent so it has an additional property session that referencess the XRSession that has ended.

Bubbles No
Cancelable No
Interface XRSessionEvent
Event handler XRSession.onend


You can use the end event in an addEventListener method:

XRSession.addEventListener("end", function(event) {
  console.log("The XR session has ended")

Or use the XRSession.onend event handler property:

XRSession.onend = function(event) {
  console.log("The XR session has ended")


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

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
end eventChrome Full support 79Edge No support NoFirefox No support NoIE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android Full support 79Firefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No


Full support  
Full support
No support  
No support