files/en-us/web/api/xrsession/visibilitystate/index.md
{{APIRef("WebXR Device API")}}{{SeeCompatTable}}{{SecureContext_Header}}
The read-only visibilityState property of the
{{DOMxRef("XRSession")}} interface is a string indicating whether the WebXR content is
currently visible to the user, and if it is, whether it's the primary focus.
Every time the visibility state changes, a {{DOMxRef("XRSession.visibilitychange_event","visibilitychange")}} event is fired on the {{DOMxRef("XRSession")}} object.
A string indicating whether or not the XR content is visible to the user and if it is, whether or not it's currently the primary focus.
The possible values of visibilityState are:
hidden
visibilityState changes.
Input controllers are not being handled for the session.visible
visible-blurred
It's important to keep in mind that because an immersive WebXR session is potentially
being shown using a different display than the HTML document in which it's running (such
as when being shown on a headset), the value of a
session's visibilityState may not necessarily be the same as the owning
{{domxref("document")}}'s {{domxref("Document.visibilityState", "visibilityState")}}.
For instance, if the viewer is using a headset tethered to a
computer and the immersive scene is obscured by a configuration UI, the user could peek
out from behind the headset and still be able to see the document itself on their
computer's monitor.
{{Specifications}}
{{Compat}}