document.caretPositionFromPoint()Baseline · Newly available
The document.caretPositionFromPoint() method finds an insertion point, represented by a DOM node and an offset within that node, for given coordinates in the viewport.
Works in the latest version of every major browser, but older devices may not support it yet. Baseline since Dec 12, 2025.
Browser support
DesktopChrome
1–127Not supported
128+Supportedsince Aug 20, 2024
Current: 155Edge
12–127Not supported
128+Supportedsince Aug 22, 2024
Current: 154Firefox
1–19Not supported
20+Supportedsince Apr 2, 2013
Current: 157Safari
1–26.1Not supported
26.2+Supportedsince Dec 12, 2025
Current: 27MobileChrome Android
18–127Not supported
128+Supportedsince Aug 20, 2024
Current: 155Firefox Android
4–19Not supported
20+Supportedsince Apr 2, 2013
Current: 157Safari iOS
1–26.1Not supported
26.2+Supportedsince Dec 12, 2025
Current: 27How to use
Every current browser supports this, but it only became Baseline on Dec 12, 2025. Use it as a progressive enhancement, or keep a fallback if you support older devices.
Example
Full syntax and examples are on MDN: CaretPosition.
Feature detection
JS · check before using
if ("Document" in globalThis && "caretPositionFromPoint" in Document.prototype) {
// Document.caretPositionFromPoint is available
}Documentation (MDN)
Sub-features
Support for each part of the feature (6). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| CaretPosition | 128 | 128 | 20 | 26.2 | 128 | 20 | 26.2 |
| CaretPosition.getClientRect | 128 | 128 | 23 | 26.2 | 128 | 23 | 26.2 |
| CaretPosition.offset | 128 | 128 | 20 | 26.2 | 128 | 20 | 26.2 |
| CaretPosition.offsetNode | 128 | 128 | 20 | 26.2 | 128 | 20 | 26.2 |
| Document.caretPositionFromPoint | 128 | 128 | 20 | 26.2 | 128 | 20 | 26.2 |
| Document.caretPositionFromPoint.options_parameter | 128 | 128 | 150 | 26.2 | 128 | 150 | 26.2 |