I want to be able to specify a text snippet in a URL fragment to link directly to it
Submitted by Raphael Louis Andress
Permalink https://webwewant.fyi/wants/85e9056e-e6e3-4fc7-902e-82b3ae7790f7/
This idea is currently being discussed.
I want every browser to support text fragment URLs, allowing me to link directly to a specific piece of text on any web page without requiring the page to have a matching id attribute.
Today, deep-linking within a page relies entirely on anchor IDs placed by the page author. If the destination page has no id on the paragraph or sentence I want to share, I cannot create a direct link to it. This makes sharing precise references from long articles, documentation pages, or search results unnecessarily difficult.
The WICG Scroll to Text Fragment proposal introduces a #:~:text= syntax in URL fragments. A link like:
https://example.com/article#:~:text=some%20quoted%20phrase
would cause the browser to scroll to and highlight the first occurrence of the quoted phrase on the page, regardless of whether the author added any anchors.
This capability is especially valuable for:
- Search engines and AI assistants that want to link users to the exact sentence answering their query, not just the top of the page.
- Documentation readers sharing a specific note or warning from a long spec page.
- Academic and research contexts where precise in-page citation matters.
Cross-browser standardization of text fragments would make this a reliable tool for everyone on the web. A consistent JavaScript API to detect, create, and manipulate text fragment URLs would make it even more powerful for developers building citation, annotation, and bookmarking tools.
- Votes
- 0
What are votes for and how are they tallied?