Link to Text Fragment
- 📖 Article: https://web.dev/text-fragments/
- 🧩 Extension: https://chrome.google.com/webstore/detail/link-to-text-fragment/pbcodcjpfjdpcineamnnmbkkmkdpajjg
- 🎬 Demo video: https://www.youtube.com/watch?v=Y5DmGqnzvBI
Installation
You can install the extension in your browser of choice:
- Google Chrome: Link to Text Fragment extension
- Microsoft Edge: Link to Text Fragment extension
- Mozilla Firefox: Link to Text Fragment extension
- Apple Safari: Link to Text Fragment extension
Usage
The Link to Text Fragment extension allows for the easy creation of text fragment URLs via the context menu:
- Select the text that you want to link to.
- Right-click and choose "Copy Link to Selected Text" from the context menu.
- If the link creation succeeded, the selected text will be briefly highlighted in yellow.
- Paste your link wherever you want to share it.
Background
The Text Fragments specification adds support for specifying a text snippet in the URL fragment.
#:~:text=[prefix-,]textStart[,textEnd][,-suffix]
When navigating to a URL with such a fragment, the user agent can quickly emphasize and/or bring it to the user's attention.
Try it out by clicking on this link: https://wicg.github.io/scroll-to-text-fragment/#ref-for-fragment-directive:~:text=%23%3A~%3Atext%3D%5Bprefix%2D%2C%5DtextStart%5B%2CtextEnd%5D%5B%2C%2Dsuffix%5D.
Acknowledgements
Text Fragments was implemented and specified by Nick Burris and David Bokan, with contributions from Grant Wang. The extension icon is courtesy of Rombout Versluijs.
License
The extension's source code is licensed under the terms of the Apache 2.0 license.
This is not an official Google product. By installing this item, you agree to the Google Terms of Service and Privacy Policy at https://www.google.com/intl/en/policies/.