Search code examples
urlparametersanchor

How to target text fragment on page with that fragment as param on URL


About a week ago I learned that you could add text segments to a URL and jump to that text on a page. I didn't even notice at first until I looked at the URL of a page that came up in a search and noticed the text segment I was linked to was added to the URL (not an ID, it was a fragment of text that matched exactly).

But apparently I have learned nothing in my years of programming because I thought it was pretty cool but I did not write down the syntax. It worked the same as if there would have been an ID in the URL as a parameter, except it was a fragment of text.

How do you link to a text segment on a page as a parameter?

I swear I remember it being something like www.google.com/?~#texthere but I can't find an example, or the page in my history.


Solution

  • Eventually I was able to get the search terms correct to get a result and found it here on stackoverflow.

    What I was looking for is apparently Google Chrome specific.

    /#:~:text=