Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What exactly is the `#:~:text=` location hash in an URL? [closed]

People also ask

How do you use exactly in a question?

You use exactly with a question to show that you disapprove of what the person you are talking to is doing or saying. What exactly do you mean?

What exactly or exactly?

Exactly is an adverb; it modifies a verb. Your first example, "What exactly is..." would be the correct form. The second is more informal; "Exactly what is..." has moved "exactly" away from the verb it is modifying.

What kind of adverb is exactly?

exactly adverb (ACCURATELY) We've come exactly 41 miles. Make sure you measure the window exactly, otherwise the shade won't fit. Exactly is sometimes used to increase emphasis: The businessmen who work in banking, she thought, all look exactly the same.


Scroll To Text Fragment

OK, with the help of a friend and at the same time via a comment from Berto99 I found it:

Apparently this is a feature called Scroll To Text Fragment. It is enabled by default since Chrome 80, but apparently not yet implemented in other browsers.

There are quite nice examples in the "W3C Community Group Draft Report". More good examples can be found on Wikipedia.

Highlighting the first appearance of a certain text

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

Example: https://example.com#:~:text=domain The word "domain" is highlighted on example.com

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

More advanced techniques

  • Prefixing and suffixing like the example suggested in the repository for the suggestion https://en.wikipedia.org/wiki/Cat#:~:text=Claws-,Like%20almost,the%20Felidae%2C,-cats texts as proposed don't seem to work for me (yet? I use Chrome 83).
  • You can style the look of the highlighted text with the CSS :target and you can opt your website out so this feature does not work with it anymore.