files/en-us/web/api/xrsession/requestreferencespace/index.md
{{APIRef("WebXR Device API")}}{{SeeCompatTable}}{{SecureContext_Header}}
The requestReferenceSpace() method of the
{{DOMxRef("XRSession")}} interface returns a {{JSxRef("promise")}} that resolves with
an instance of either {{DOMxRef("XRReferenceSpace")}}
or {{DOMxRef("XRBoundedReferenceSpace")}} as appropriate given the type of reference
space requested.
requestReferenceSpace(referenceSpaceType)
type
A {{JSxRef("Promise")}} that resolves with an {{DOMxRef("XRReferenceSpace")}} object.
The types of reference space are listed below, with brief information about their use cases and which interface is used to implement them.
bounded-floor
local type, except the user is not expected to move outside a predetermined boundary, given by the {{domxref("XRBoundedReferenceSpace.boundsGeometry", "boundsGeometry")}} in the returned object.local
local reference space tries to keep the origin stable relative to the environment.local-floor
local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. If that floor level isn't known, the {{Glossary("user agent")}} will estimate the floor level. If the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter).unbounded
viewer
Rather than throwing true exceptions, requestReferenceSpace() rejects the
returned promise with a {{domxref("DOMException")}} whose name is found in the list
below:
NotSupportedError
{{Specifications}}
{{Compat}}