Sunday, September 12, 2021

web: Chrome: URL based text highlighting `#:~:text=`

 Google Chrome now lets you link people to highlighted text on a website


google chrome - What exactly is the `#:~:text=` location hash in an URL? - Stack Overflow

Highlighting the first appearance of a certain text

Just append #:~:text=<text> to the URL. The text search is not case-sensitive.


The word "domain" is highlighted on example.com


Scroll to Text Fragment - Chrome Platform Status


[https://en.wikipedia.org/wiki/Cat#:~:text=On%20islands,%20birds%20can%20contribute%20as%20much%20as%2060%%20of%20a%20cat%27s%20diet] This loads the page for Cat, highlights the specified text, and scrolls directly to it.


Highlighting a whole section of text

You can use #:~:text=<first word>,<last word> to highlight a whole section of text.


Example: https://stackoverflow.com/questions/62161819/what-exactly-is-the-text-location-hash-in-an-url/62162093#:~:text=Apparently,Wikipedia part of this very answer is highlighted





No comments: