Text selection and caret
Lets the page see what is selected inside itself and move the cursor; nothing outside the page.
In one line
Can see which of its own words you highlight and move your text cursor
Lets the page see what is selected inside itself and move the cursor; nothing outside the page.
A site knows which of its own words the person highlights, which reveals interest and reading focus. It cannot see a selection in another tab or app.
What it can and can't do
What the user does: You highlight text or click in a box on the page
It can
- See the text you select on the page
- Move the cursor or change the selection on its own page
- Guess what you are interested in from what you highlight
It cannot
- See selections in other tabs or apps
- See what you select when the page is in the background
- Show a permission pop up; there is none
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 1 | 2008-12-11 | None |
| Edge | Supported | 12 | 2015-07-29 | None |
| Firefox | Supported | 1 | 2004-11-09 | None |
| Safari | Supported | 1 | 2003-06-23 | None |
| Safari on iPhone | Supported | 1 | 2007-06-29 | All iOS browsers use WebKit |
| Chrome on Android | Supported | 18 | 2012-06-27 | None |
| Samsung Internet | Supported | 1.0 | 2013-04-27 | None |
How a site asks for it
| API | window.getSelection(); selectionchange event; input.selectionStart; Range.getBoundingClientRect() |
| Browser compat keys | api.Window.getSelectionapi.Document.selectionchange_eventapi.Selection |
| How access is granted | none |
| What the user sees | None (no browser prompt) |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| Activation | none |
| How long it lasts | Live while the page has focus |
| How to take it back | Nothing to revoke (no permission is stored) |
| Inside an iframe | Frames see only their own selection; selection in a cross-origin iframe is hidden from the parent |
Typical flow
- Person selects text
- selectionchange fires on the document
- Page reads the Selection and Range
Data you get
Shape: none
No individual data fields. The signal is the access itself.
Technical limits
- Sees selection inside its own document (and same-origin frames) only
- Cannot read the selection from the address bar, other tabs, other apps or browser UI
- Password fields: selected text of a password input is not exposed by getSelection().toString() but is readable via the field's value to the page owner
- selectionchange has no rate limit; it can fire many times per second while dragging
- Firefox returns the selection inside inputs only through selectionStart and selectionEnd
The story
What it is
The page sees which of its own words you highlight and where your text cursor is.
For you
You highlight text to copy, look up or share. A small menu may pop up near it. You did not know the page could tell which words you picked. It cannot see selections in other tabs or apps.
For makers
Makers use selection to show a share, quote or highlight menu. Reading apps remember highlights and analytics tools learn what people find interesting.
Where you see it
| Type | Example | Apps |
|---|---|---|
| media | A long read site shows a 'share this quote' button when a reader highlights a sentence. | Medium, The Atlantic |
| education | An e-reader or course page saves a student's highlights and notes for later. | Kindle Cloud Reader, Perusall |
| productivity | A document editor uses selection to show a bold or link toolbar. | Google Docs, Notion |
| games | A word game or learning site checks which word a player picked from a passage. | None named |
| analytics | A publisher counts which lines get highlighted most to see what resonates. | None named |
| ads | A dictionary or search widget can show an ad or lookup for the exact words you picked. | None named |
Risks
- Reveals what you find interesting
- Highlights recorded
Good uses and abuse
Legitimate uses
- Quote and share tools
- Dictionary lookups
- Rich text editors
Known abuse
- Tracking what people highlight (reading attention)
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 2 of 5 | How revealing the data is |
| Utility | 4 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2011, Firefox 8: selectionchange event
Related capabilities
Related
- Keyboard and IME events. Can see each key you press while the page has focus
Sources
How well checked: Based on official documentation.