Scroll to text fragment
Highlights and scrolls to quoted text in a page when a link includes #:~:text=.
In one line
Can scroll to and highlight text on a page when you open a special link
Highlights and scrolls to quoted text in a page when a link includes #:~:text=.
A link can point at one sentence on any page. The browser, not the page, does the highlighting, and the page cannot see the fragment, so it cannot learn what the visitor was searching for.
What it can and can't do
What the user does: You tap a link that ends with a text highlight, like a link shared from search results.
It can
- Jump to quoted text on the page and highlight it
- Open from a link that someone shared with you
- Show a short highlight in yellow
It cannot
- Let the page's own code see which text was highlighted
- Highlight text that is not on the page
- Highlight text inside embedded frames in most cases
- Run without you opening that link
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 81 | 2020-04-07 | None |
| Edge | Supported | 83 | 2020-05-21 | None |
| Firefox | Supported | 131 | 2024-10-01 | None |
| Safari | Supported | 18.4 | 2025-03-31 | None |
| Safari on iPhone | Supported | 18.4 | 2025-03-31 | All iOS browsers use WebKit |
| Chrome on Android | Supported | 81 | 2020-04-07 | None |
| Samsung Internet | Supported | 13.0 | 2020-12-02 | None |
How a site asks for it
| API | https://example.com/#:~:text=start,end; document.fragmentDirective; ::target-text |
| Browser compat keys | api.FragmentDirectivecss.selectors.target-text |
| 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 | One-shot per navigation |
| How to take it back | Nothing to revoke (no permission is stored) |
| Inside an iframe | Only full navigations in top-level browsing contexts |
Typical flow
- Person opens a link with a text directive
- Browser finds the first match and scrolls
- Highlight is drawn by the browser
Data you get
Shape: none
No individual data fields. The signal is the access itself.
Technical limits
- Needs user activation or browser-initiated navigation (search results, address bar)
- Page script cannot read the directive (stripped from location.hash and document.fragmentDirective is empty)
- Matches visible text only, word boundary aware, first match wins
- Cross-origin initiated navigations need noopener; not applied in iframes
- Can be disabled by Document-Policy: force-load-at-top
The story
What it is
A link can highlight and scroll to exact words on a page.
For you
You tap a link and the page jumps to a highlighted sentence. Search results use it so you land on the answer, not the top of the page.
For makers
Makers and search engines use it to send people to the exact passage. Google search snippets use it and some sharing tools make quote links with it.
Where you see it
| Type | Example | Apps |
|---|---|---|
| news | A search result links to the exact sentence that answers your question. | Google Search |
| social | A reader copies a link to a quote from an article and sends it to a friend. | Chrome, Edge |
| education | A teacher links students to the exact definition inside a long page. | Wikipedia |
| productivity | A research tool saves quotes as links back to the highlighted text. | None named |
| ads | A site may use it to find out whether specific words exist on a page. | None named |
| developer | A docs site links straight to the line about a function. | MDN |
Risks
- Probing page text
- Misleading highlights
What the platform says
- Google: Text fragments. Chrome's docs say you can link right to a specific passage of a page.
Good uses and abuse
Legitimate uses
- Search engine deep links
- Shareable quotes
Known abuse
- Probing page contents with crafted links (mitigated by activation, no readable fragment)
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 1 of 5 | How revealing the data is |
| Utility | 3 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
- 2020-02, Chrome 80: Scroll to Text Fragment ships
- 2022-10, Safari 16.1: Text fragment support
- 2024-10, Firefox 131: Text fragment support ships
Sources
How well checked: Based on official documentation.