Copy link to text in page [Chrome specific at the moment]

There seems to be a chrome feature for copying a link to a specific excerpt of a web page: https://www.howtogeek.com/726473/how-to-create-a-link-to-selected-text-in-chrome/

The format of the link seems to be:

https://example.com/foo#:~:text=URL:%20encoded%20text

real example https://www.howtogeek.com/726473/how-to-create-a-link-to-selected-text-in-chrome/#:~:text=When%20the%20recipient%20clicks%20the%20link

The URL construction looks straightforward to guess but I wonder if there are any gotchas.

I wonder if there is a standard for this or is it or Chrome specific? Since it’s done with a fragment it’s likely harmless to any browsers that don’t support it.

A PopClip extension for this might be handy. (tweet)

Extension snippet, seems to work!

#popclip
name: Copy Excerpt Link
icon: square E
javascript: popclip.copyText(popclip.context.browserUrl + '#:~:text=' + encodeURIComponent(popclip.input.text))

(The above block is an extension snippet - select it to install the extension with PopClip)

1 Like

Didn’t understand the above, and this my fault. Can’t code. So, dumb question, if I use this safari what will I be able to do?

1 Like

This technique doesn’t seem to work in Safari on iOS (at least on my iPhone) — your example URL just opens the page at the top.

But combined with Choosy — or even just a chrome:// url handler, if that works out of the box — this would be amazing.

To try to explain: If you use Chrome, and you add something to end of any URL in Chrome, you can link not just to the top of the page, but to the place on the page where certain text appears. The part you add to the end of the URL is the text you’re linking to (but “encoded,” so spaces and other characters that don’t work on URLs are turned into %20 or something similar).

1 Like

The feature is unique to Chrome:

https://www.howtogeek.com/658842/how-to-use-google-chromes-new-deep-linking-feature/#:~:text=Chrome%2080%20makes%20that%20possible,Google%20Chrome%2080%20for%20now.

However there is a movement underway to develop a universal method to link among apps

2 Likes

Thanks for that @rkaplan and everyone! :sunglasses:
I hadn’t heard of this Chrome feature till yesterday when I saw a tweet asking for a PopClip extension to do the same thing. Glad I used the forum to flesh it out… I like how it can be a kind of interactive notebook.

1 Like