Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.
The caretRangeFromPoint() method of the Document interface returns a Range object for the document fragment under the specified coordinates.
This method is the WebKit-proprietary implementation of the Document.caretPositionFromPoint method.
caretRangeFromPoint(x, y)
xA horizontal position within the current viewport.
yA vertical position within the current viewport.
One of the following:
Range.Null, if x or y are negative, outside viewport, or there is no text entry node.Visit the Document.caretPositionFromPoint page to view a live sample of this method.
Not part of any specification.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
caretRangeFromPoint |
4 | 12 | No | 15 | 5 | 18 | No | 14 | 4 | 1.0 | 4.4 | 4 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Document/caretRangeFromPoint