• The result of a text fragment link. Note the highlighted text and the URL. Ron Amadeo
  • With the extension installed, just highlight the text you want and right-click. Ron Amadeo

Google has been cooking up an extension to the URL standard called "Text Fragments." The new link style will allow you to link not just to a page but to specific text on a page, which will get scrolled to and highlighted automatically once the page loads. It's like an anchor link, but with highlighting and creatable by anyone.

The feature has actually been supported in Chrome since version 80, which hit the stable channel in February. Now a new extension from Google makes it easy to create this new link type, which will work for anyone else using Chrome on desktop OSes and Android. Google has proposed the idea to the W3C and hopes other browsers will adopt it, but even if they don't, the links are backward-compatible.

The syntax for this URL is pretty strange looking. After the URL, the magic is in the string "#:~:text=" and then whatever text you want to match. So a full link would look like this: breeds of cat have a noted fondness for sitting in high places

If you copy and paste this into Chrome, the browser will open Wikipedia's cat page, scroll to the first text that matches "Most breeds of cat have a noted fondness for sitting in high places," and will highlight it. If the text doesn't match anything, the page will still load. Backward-compatibility works because browsers currently support the number sign (#) as a URI fragment, which usually gets used for anchor links that are made by the page creator. If you paste this into a browser that doesn't support it, the page will still load, and everything after the number sign will just be ignored as a bad anchor link. So far, so good.

One problem is that this means you can have spaces in a URL. On a webpage or forum, you can hand-code the link with a href tag (or whatever the non-HTML equivalent is) and everything will work. For instant messengers and social media though, which don't allow code and use automatic URL parsers, things get a bit more complicated. Every URL parser treats a space as the end of a URL, so you'll need to use percent-encoding to replace all the spaces with the equivalent "%20." URL parsers now have a shot at linkifying this correctly, but it looks like a mess:

Spaces aren't the only characters that can cause problems. The standard RFC 3986 defines several "reserved&quotRead More – Source

[contf] [contfnew]


[contfnewc] [contfnewc]


Please enter your comment!
Please enter your name here