This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.
The endOffset property of the AbstractRange interface returns the offset into the end node of the range's end position.
An integer value indicating the number of characters into the Node indicated by endContainer at which the final character of the range is located.
let endOffset = range.endOffset;
| Specification |
|---|
| DOM> # ref-for-dom-range-endoffset①> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
endOffset |
90 | 9018–79 | 69 | 76 | 14.1 | 90 | 79 | 64 | 14.5 | 15.0 | 90 | 14.5 |
© 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/AbstractRange/endOffset