I've noticed some web URLs link to a web page with highlighted text. This appears to be controlled by an escape sequence in the URL of the form #:~:text=StartText,EndText, where StartText indicates where on the page to begin the highlighting and EndText is where on the page to terminate the highlighting.


I've seen query strings and named anchors/fragments in URLs (as per standard URL syntax), but I've never seen escape sequences in URLs -- certainly not like this.

What API/standard/protocol/etc. defines/permits/governs this highlighting behavior?

Bonus points for addressing how portable this is. (It works on Google Chrome, but doesn't work in Apple's Safari for macOS.)


This is called Scroll To Text Fragment, and arrived in Chrome 80.

Here is the draft specification, and the original proposal.

It seems to me that this is another feature that Google just added to Chrome without other browser vendors signaling any interest (like Portals, though that one never graduated from being a flag). Here is an article that calls Scroll To Text Fragment "controversial".

Scroll To Text Fragment is currently available only in Chrome and other Chromium browsers (e.g. the new Edge).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.